-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
115 lines (92 loc) · 2.59 KB
/
uninstall.sh
File metadata and controls
115 lines (92 loc) · 2.59 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env bash
set -e
APP_NAME="git-genius"
BIN_NAME="git-genius"
GREEN="\033[0;32m"
RED="\033[0;31m"
YELLOW="\033[1;33m"
NC="\033[0m"
log() { echo -e "${GREEN}✔ $1${NC}"; }
warn() { echo -e "${YELLOW}⚠ $1${NC}"; }
err() { echo -e "${RED}✖ $1${NC}"; }
echo "======================================="
echo " Git Genius Uninstaller"
echo "======================================="
echo
# --------------------------------------------------
# Detect environment
# --------------------------------------------------
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ENV="unknown"
if [[ -n "$PREFIX" && "$PREFIX" == *"com.termux"* ]]; then
ENV="termux"
elif [[ "$HOME" == *"androidide"* ]]; then
ENV="androidide"
elif [[ "$OS" == "darwin" ]]; then
ENV="macos"
elif [[ "$OS" == "linux" ]]; then
if command -v sudo >/dev/null 2>&1; then
ENV="linux"
else
ENV="restricted-linux"
fi
fi
log "Environment: $ENV"
# --------------------------------------------------
# Remove binary
# --------------------------------------------------
REMOVED=false
remove_bin() {
if [[ -f "$1/$BIN_NAME" ]]; then
rm -f "$1/$BIN_NAME"
log "Removed binary: $1/$BIN_NAME"
REMOVED=true
fi
}
remove_bin "$HOME/bin"
remove_bin "/usr/local/bin"
# --------------------------------------------------
# Remove source directory
# --------------------------------------------------
SRC_DIR="$HOME/.git-genius-src"
if [[ -d "$SRC_DIR" ]]; then
rm -rf "$SRC_DIR"
log "Removed source directory: $SRC_DIR"
fi
# --------------------------------------------------
# Remove app data (safe)
# --------------------------------------------------
DATA_DIR="$HOME/.git-genius"
if [[ -d "$DATA_DIR" ]]; then
rm -rf "$DATA_DIR"
log "Removed app data directory: $DATA_DIR"
fi
# --------------------------------------------------
# Remove PATH entries (non-destructive)
# --------------------------------------------------
clean_path_file() {
FILE="$1"
[[ -f "$FILE" ]] || return
if grep -q "git-genius" "$FILE"; then
sed -i.bak '/git-genius/d' "$FILE"
log "Cleaned PATH entry from $FILE (backup created)"
fi
}
clean_path_file "$HOME/.bashrc"
clean_path_file "$HOME/.profile"
clean_path_file "$HOME/.zshrc"
# --------------------------------------------------
# Summary
# --------------------------------------------------
echo
if [[ "$REMOVED" == true ]]; then
log "Git Genius completely uninstalled ✅"
else
warn "Git Genius binary not found (already removed?)"
fi
echo
echo "You can now:"
echo " • Reinstall a fresh version"
echo " • Test installer safely"
echo
echo "======================================="