-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·71 lines (60 loc) · 1.86 KB
/
uninstall.sh
File metadata and controls
executable file
·71 lines (60 loc) · 1.86 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
#!/bin/bash
set -e
# Define paths
SHELL_BIN="/usr/local/bin/shell"
SHELL_DIR="/opt/shell"
SHELL_CONFIG="/etc/shell"
SHELL_LOG="/var/log/shell"
SHELL_STATE="/var/lib/shell"
SHELL_RUN="/var/run/shell"
SHELL_SYSTEMD="/etc/systemd/system"
SHELL_USER="shell"
SHELL_GROUP="shell"
SUDOERS_FILE="/etc/sudoers.d/shell"
# macOS paths
if [[ "$(uname)" == "Darwin" ]]; then
SHELL_CONFIG="$HOME/Library/Application Support/shell/config"
SHELL_LOG="$HOME/Library/Logs/shell"
SHELL_STATE="$HOME/Library/Application Support/shell/secrets"
fi
echo "🛑 Note: Shell is a standalone CLI tool without systemd services"
echo "🧹 Removing shell binary..."
if [[ -f "${SHELL_BIN}" ]]; then
sudo rm -f "${SHELL_BIN}"
echo "✓ Removed ${SHELL_BIN}"
fi
echo "🗑️ Removing configuration and log directories..."
# Remove directories if they exist
if [[ -d "${SHELL_CONFIG}" ]]; then
sudo rm -rf "${SHELL_CONFIG}"
echo "✓ Removed ${SHELL_CONFIG}"
fi
if [[ -d "${SHELL_LOG}" ]]; then
sudo rm -rf "${SHELL_LOG}"
echo "✓ Removed ${SHELL_LOG}"
fi
if [[ -d "${SHELL_STATE}" ]]; then
sudo rm -rf "${SHELL_STATE}"
echo "✓ Removed ${SHELL_STATE}"
fi
if [[ -d "${SHELL_DIR}" ]]; then
sudo rm -rf "${SHELL_DIR}"
echo "✓ Removed ${SHELL_DIR}"
fi
# Remove user and group if they exist (Linux only)
if [[ "$(uname)" == "Linux" ]]; then
echo "👤 Removing shell user and group..."
if id "${SHELL_USER}" &>/dev/null; then
sudo userdel "${SHELL_USER}" || true
echo "✓ Removed user ${SHELL_USER}"
fi
if getent group "${SHELL_GROUP}" &>/dev/null; then
sudo groupdel "${SHELL_GROUP}" || true
echo "✓ Removed group ${SHELL_GROUP}"
fi
if [[ -f "${SUDOERS_FILE}" ]]; then
sudo rm -f "${SUDOERS_FILE}"
echo "✓ Removed sudoers file"
fi
fi
echo " Shell has been completely removed from the system."