-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·89 lines (79 loc) · 2.91 KB
/
uninstall.sh
File metadata and controls
executable file
·89 lines (79 loc) · 2.91 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
#!/usr/bin/env bash
# uninstall.sh — Uninstaller for AIworkbench
# Removes all installed components
set -o pipefail
# Colors
msg() { printf "\033[1;32m==>\033[0m %s\n" "$*"; }
warn() { printf "\033[1;33m!! \033[0m%s\n" "$*" >&2; }
err() { printf "\033[1;31mEE \033[0m%s\n" "$*" >&2; }
# Paths (same as install.sh)
AIWB_HOME="${HOME}/.aiwb"
DEST_BIN_DEFAULT="${HOME}/.local/bin"
DEST_BIN_FALLBACK="${HOME}/bin"
echo "╔════════════════════════════════════════╗"
echo "║ AIworkbench Uninstaller ║"
echo "╚════════════════════════════════════════╝"
echo
# Confirm
read -p "This will remove AIworkbench and all its data. Continue? [y/N] " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
msg "Uninstall cancelled."
exit 0
fi
# 1. Remove binaries from ~/.local/bin or ~/bin
msg "Removing binaries..."
for bin_dir in "$DEST_BIN_DEFAULT" "$DEST_BIN_FALLBACK"; do
if [[ -f "${bin_dir}/aiwb" ]]; then
rm -f "${bin_dir}/aiwb"
msg "Removed ${bin_dir}/aiwb"
fi
# Remove lib directory
if [[ -d "${bin_dir}/lib" ]]; then
rm -rf "${bin_dir}/lib"
msg "Removed ${bin_dir}/lib/"
fi
# Remove any bin-edit scripts
for script in "${bin_dir}/"*.sh; do
if [[ -f "$script" ]] && grep -q "AIworkbench\|aiwb" "$script" 2>/dev/null; then
rm -f "$script"
msg "Removed $script"
fi
done
done
# 2. Remove AIWB home directory
if [[ -d "$AIWB_HOME" ]]; then
msg "Removing AIWB home directory: ${AIWB_HOME}"
rm -rf "$AIWB_HOME"
msg "Removed ${AIWB_HOME}"
else
warn "AIWB home directory not found: ${AIWB_HOME}"
fi
# 3. Clean PATH export from shell rc files (optional)
clean_rc() {
local rc_file="$1"
if [[ -f "$rc_file" ]]; then
if grep -q "AIworkbench installer" "$rc_file"; then
msg "Cleaning PATH export from ${rc_file}"
# Remove the AIworkbench PATH lines
sed -i.bak '/# AIworkbench installer/d' "$rc_file"
sed -i.bak '/export PATH=.*\.local\/bin/d' "$rc_file"
rm -f "${rc_file}.bak"
fi
fi
}
clean_rc "${HOME}/.bashrc"
clean_rc "${HOME}/.zshrc"
echo
msg "╔════════════════════════════════════════╗"
msg "║ Uninstall complete! ║"
msg "╚════════════════════════════════════════╝"
echo
echo "Removed:"
echo " • AIWB home directory (~/.aiwb/)"
echo " • Binary files (~/.local/bin/aiwb)"
echo " • Libraries (~/.local/bin/lib/)"
echo " • PATH exports from shell rc files"
echo
echo "Note: Dependencies (jq, curl, fzf, gum, etc.) were NOT removed."
echo "Restart your terminal or run: source ~/.bashrc"