2024-01-09 15:48:11 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-01-12 01:55:39 +00:00
|
|
|
action=${action:?}
|
|
|
|
|
2024-05-12 21:50:11 +00:00
|
|
|
# do nothing on some selected actions
|
|
|
|
if [ "$action" = "completions" ] || [ "$action" = "flatpak" ] || [ "$action" = "run" ]
|
2024-01-09 15:48:11 +00:00
|
|
|
then
|
2024-01-12 02:14:51 +00:00
|
|
|
return
|
2024-01-09 15:48:11 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
clean=${args[--clean]:-}
|
|
|
|
target=${args[target]:?}
|
|
|
|
|
2024-01-12 01:55:39 +00:00
|
|
|
if [ "$action" = "exe" ]
|
2024-01-09 15:48:11 +00:00
|
|
|
then
|
|
|
|
target="$HOME/.local/bin/$target"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$clean" ] || [ -n "${AUTOINSTALL_CLEAN:-}" ]
|
|
|
|
then
|
|
|
|
echo "Cleaning $target"
|
2024-03-22 21:14:13 +00:00
|
|
|
|
|
|
|
# sanity checks
|
|
|
|
if [ -z "$target" ] || [ "$target" = "/" ] || [ "$target" = "$HOME" ] || [ "$target" = "$HOME/" ]
|
|
|
|
then
|
|
|
|
echo "Invalid target: '$target'"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-01-09 15:48:11 +00:00
|
|
|
rm -rf "$target"
|
|
|
|
fi
|