fleet/pkg/file/scripts/uninstall_pkg.sh
Lucas Manuel Rodriguez 862cd142a3
Add filter to default unintaller for pkgs to only remove .app folders (#22585)
#22571

- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files)
for more information.
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality
2024-10-02 17:50:27 -03:00

18 lines
No EOL
441 B
Bash

#!/bin/sh
package_app_name="$PACKAGE_ID"
# Make sure PACKAGE_ID is not empty.
if [[ -z "$package_app_name" ]]; then
echo "Empty PACKAGE_ID variable."
exit 1
fi
# Make sure the PACKAGE_ID doesn't have "../" or is "."
if [[ "$package_app_name" == *".."* || "$package_app_name" == "." ]]; then
echo "Invalid PACKAGE_ID value."
exit 1
fi
echo "Removing \"/Applications/$package_app_name\"..."
rm -rf "/Applications/$package_app_name"