-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathuninstall.sh
More file actions
37 lines (30 loc) · 903 Bytes
/
uninstall.sh
File metadata and controls
37 lines (30 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
# Bannerhunter Uninstaller
# Works on Linux and Termux
set -e
TOOL_NAME="bannerhunter"
INSTALL_PATH_LINUX="/usr/local/bin/$TOOL_NAME"
INSTALL_PATH_TERMUX="$PREFIX/bin/$TOOL_NAME"
echo "Detecting environment..."
# Detect Termux or Linux
if [[ -n "$PREFIX" && -d "$PREFIX/bin" && "$PREFIX" == *com.termux* ]]; then
ENVIRONMENT="termux"
INSTALL_PATH="$INSTALL_PATH_TERMUX"
else
ENVIRONMENT="linux"
INSTALL_PATH="$INSTALL_PATH_LINUX"
fi
echo "Environment: $ENVIRONMENT"
# Linux requires root
if [[ "$ENVIRONMENT" == "linux" && "$EUID" -ne 0 ]]; then
echo "Error: Please run this uninstaller as root."
exit 1
fi
# Remove installed binary
if [[ -f "$INSTALL_PATH" ]]; then
echo "Removing $INSTALL_PATH"
rm -f "$INSTALL_PATH"
echo "Bannerhunter has been uninstalled successfully."
else
echo "Bannerhunter is not installed in $INSTALL_PATH"
fi