Add installation and uninstallation scripts with updated README instructions
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
./uninstall.sh [--dry-run]
|
||||
|
||||
Options:
|
||||
--dry-run Show what would be removed without deleting files.
|
||||
EOF
|
||||
}
|
||||
|
||||
DRY_RUN=0
|
||||
case "${1:-}" in
|
||||
"") ;;
|
||||
--dry-run) DRY_RUN=1 ;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: ${1}" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
TARGETS=(
|
||||
"$HOME/.local/bin/nextdns-tray"
|
||||
"$HOME/.local/share/applications/nextdns-tray.desktop"
|
||||
"$HOME/.local/share/icons/nextdns.png"
|
||||
"$HOME/.config/autostart/nextdns-tray.desktop"
|
||||
)
|
||||
|
||||
remove_file() {
|
||||
local path="$1"
|
||||
if [[ -e "$path" ]]; then
|
||||
if [[ "$DRY_RUN" -eq 1 ]]; then
|
||||
echo "Would remove: $path"
|
||||
else
|
||||
rm -f "$path"
|
||||
echo "Removed: $path"
|
||||
fi
|
||||
else
|
||||
echo "Not present: $path"
|
||||
fi
|
||||
}
|
||||
|
||||
for path in "${TARGETS[@]}"; do
|
||||
remove_file "$path"
|
||||
done
|
||||
|
||||
if [[ "$DRY_RUN" -eq 0 ]]; then
|
||||
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||
update-desktop-database "$HOME/.local/share/applications" >/dev/null 2>&1 || true
|
||||
fi
|
||||
echo "Uninstall complete"
|
||||
else
|
||||
echo "Dry run complete"
|
||||
fi
|
||||
Reference in New Issue
Block a user