update with uninstaller

This commit is contained in:
AJ ONeal 2017-05-08 20:06:25 -06:00
parent b57b18f5ed
commit e70da5af22
2 changed files with 49 additions and 0 deletions

View File

@ -168,6 +168,12 @@ dap_dl_bash "https://git.daplie.com/coolaj86/node-install-script/raw/master/setu
# Install # Install
npm install -g 'git+https://git@git.daplie.com/Daplie/goldilocks.js.git#v1' npm install -g 'git+https://git@git.daplie.com/Daplie/goldilocks.js.git#v1'
# Unistall
dap_dl "https://git.daplie.com/Daplie/goldilocks.js/raw/master/uninstall.sh" "./goldilocks-uninstall.sh"
$sudo_cmd chmod 755 "./goldilocks-uninstall.sh"
$sudo_cmd chown root:root "./goldilocks-uninstall.sh"
$sudo_cmd mv "./goldilocks-uninstall.sh" "/usr/local/bin/"
# Set perms # Set perms
$sudo_cmd mkdir -p /srv/www $sudo_cmd mkdir -p /srv/www
$sudo_cmd mkdir -p /etc/goldilocks $sudo_cmd mkdir -p /etc/goldilocks

43
uninstall.sh Normal file
View File

@ -0,0 +1,43 @@
#!/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"
$sudo_cmd rm -f /usr/local/bin/goldilocks
$sudo_cmd rm -rf /usr/local/lib/node_modules/goldilocks
$sudo_cmd rm -f "$MY_ROOT/$my_app_etc_config"
$sudo_cmd rmdir -p $(dirname "$MY_ROOT/$my_app_etc_config")
$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