initial commit
This commit is contained in:
36
bin/scripts/uninstall.sh
Executable file
36
bin/scripts/uninstall.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source bin/helpers/func.sh
|
||||
|
||||
# Test for root privileges if uninstalling system-wide files
|
||||
NEED_ROOT=0
|
||||
if [ -f /usr/local/bin/sshtunnel ] || [ -f /usr/share/bash-completion/completions/sshtunnel ] || [ -f /usr/local/share/sshtunnel/sshtunnel.version ]; then
|
||||
NEED_ROOT=1
|
||||
fi
|
||||
if [ $NEED_ROOT -eq 1 ] && [ "$EUID" -ne 0 ]; then
|
||||
printfe "%s\n" "red" "Please run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove user-local files
|
||||
printfe "%s\n" "cyan" "Removing sshtunnel from user-local locations..."
|
||||
if [ -f $HOME/.local/bin/sshtunnel ]; then
|
||||
log_and_run rm $HOME/.local/bin/sshtunnel
|
||||
fi
|
||||
if [ -f $HOME/.local/bin/sshtunnel-completion.bash ]; then
|
||||
log_and_run rm $HOME/.local/bin/sshtunnel-completion.bash
|
||||
fi
|
||||
|
||||
# Remove system-wide files using log_and_run
|
||||
printfe "%s\n" "cyan" "Removing sshtunnel from system-wide locations..."
|
||||
if [ -f /usr/share/bash-completion/completions/sshtunnel ]; then
|
||||
log_and_run rm /usr/share/bash-completion/completions/sshtunnel
|
||||
fi
|
||||
if [ -f /usr/local/bin/sshtunnel ]; then
|
||||
log_and_run rm /usr/local/bin/sshtunnel
|
||||
fi
|
||||
if [ -f /usr/local/share/sshtunnel/sshtunnel.version ]; then
|
||||
log_and_run rm /usr/local/share/sshtunnel/sshtunnel.version
|
||||
fi
|
||||
|
||||
printfe "%s\n" "green" "Uninstall complete."
|
Reference in New Issue
Block a user