2017-05-09 02:06:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# something or other about android and tmux using PREFIX
|
|
|
|
#: "${PREFIX:=''}"
|
|
|
|
MY_ROOT=""
|
|
|
|
if [ -z "${PREFIX-}" ]; then
|
|
|
|
MY_ROOT=""
|
|
|
|
else
|
|
|
|
MY_ROOT="$PREFIX"
|
|
|
|
fi
|
|
|
|
# Not every platform has or needs sudo, gotta save them O(1)s...
|
|
|
|
sudo_cmd=""
|
|
|
|
((EUID)) && [[ -z "$ANDROID_ROOT" ]] && sudo_cmd="sudo"
|
|
|
|
|
|
|
|
# you don't want any oopsies when an rm -rf is involved...
|
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
|
|
|
|
my_app_name=goldilocks
|
|
|
|
my_app_pkg_name=com.daplie.goldilocks.web
|
|
|
|
|
|
|
|
my_app_etc_config="etc/${my_app_name}/${my_app_name}.yml"
|
|
|
|
my_app_systemd_service="etc/systemd/system/${my_app_name}.service"
|
|
|
|
my_app_systemd_tmpfiles="etc/tmpfiles.d/${my_app_name}.conf"
|
|
|
|
my_app_launchd_service="Library/LaunchDaemons/${my_app_pkg_name}.plist"
|
|
|
|
my_app_upstart_service="etc/init.d/${my_app_name}.conf"
|
|
|
|
|
|
|
|
|
2017-05-16 04:34:30 +00:00
|
|
|
$sudo_cmd rm -f /usr/local/bin/$my_app_name
|
|
|
|
$sudo_cmd rm -f /usr/local/bin/uninstall-$my_app_name
|
|
|
|
$sudo_cmd rm -rf /usr/local/lib/node_modules/$my_app_name
|
2017-05-09 02:06:25 +00:00
|
|
|
|
|
|
|
$sudo_cmd rm -f "$MY_ROOT/$my_app_etc_config"
|
2017-05-09 02:11:06 +00:00
|
|
|
$sudo_cmd rmdir -p $(dirname "$MY_ROOT/$my_app_etc_config") 2>/dev/null || true
|
2017-05-09 02:06:25 +00:00
|
|
|
$sudo_cmd rm -f "$MY_ROOT/$my_app_systemd_service"
|
|
|
|
$sudo_cmd rm -f "$MY_ROOT/$my_app_systemd_tmpfiles"
|
|
|
|
$sudo_cmd rm -f "$MY_ROOT/$my_app_launchd_service"
|
|
|
|
$sudo_cmd rm -f "$MY_ROOT/$my_app_upstart_service"
|
|
|
|
|
|
|
|
$sudo_cmd rm -rf /opt/$my_app_name
|
|
|
|
$sudo_cmd rm -rf /var/log/$my_app_name
|
|
|
|
|
|
|
|
# TODO flag for --purge
|
|
|
|
#rm -rf /etc/goldilocks
|
2017-05-09 02:11:06 +00:00
|
|
|
|
|
|
|
# TODO trap uninstall function
|
|
|
|
|
|
|
|
echo "uninstall complete: $my_app_name"
|