-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall-nottbox.sh
78 lines (63 loc) · 1.71 KB
/
uninstall-nottbox.sh
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
#!/bin/bash
# Parse command-line options
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-f|--remove-log)
remove_log=true
shift
;;
*)
echo "Unknown option: $key"
exit 1
;;
esac
done
# Stop the Nottbox service if it's running
echo ""
echo "Stopping the Nottbox service..."
systemctl stop nottbox
# Disable the Nottbox service from starting on boot if it's enabled
echo ""
echo "Disabling the Nottbox service..."
systemctl disable nottbox
# Remove the Nottbox service unit file
echo ""
echo "Deleting the Nottbox service..."
rm /etc/systemd/system/nottbox.service
# Reload systemd daemon after removing the service file
echo ""
echo "Reloading systemd daemomn..."
systemctl daemon-reload
# Move log file to /root/nottbox.log
if [ "$remove_log" != true ]; then
mv /root/nottbox/nottbox.log /root/nottbox.log
fi
# Remove the Nottbox directory
echo ""
echo "Removing the Nottbox directory..."
rm -rf /root/nottbox
# Uninstall the git package
echo ""
echo "Uninstalling git..."
apt-get remove --purge git -y > /dev/null 2>&1;
# Clean up unused packages and dependencies (optional)
echo ""
echo "Cleaning up packages..."
apt-get autoremove -y > /dev/null 2>&1;
echo ""
echo "----------------------------------------------------------------------"
echo ""
echo "Nottbox has been uninstalled."
# Schedule self-destruct using 'at' command
# echo "rm -- \"\$0\"" | at now + 15 seconds
# echo ""
# echo "This uninstall script will self-destruct in 10 seconds."
echo ""
echo "Thank you for using Nottbox! - https://github.com/sam-morin/nottbox"
echo ""
if [ "$(pwd)" = "/root/nottbox" ]; then
cd /root
fi
# Exit the script gracefully
exit 0