-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRemove.sh
executable file
·65 lines (53 loc) · 1.92 KB
/
Remove.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
#!/bin/bash
# Function to wait for any key press
wait_for_keypress() {
echo -e "${CYAN}Press any key to close this window...${RESET}"
read -n 1 -s
}
# Define color codes
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
CYAN='\033[1;36m'
WHITE='\033[1;37m'
RESET='\033[0m'
# Trap errors and display a message
trap 'echo -e "${RED}❌ An error occurred. Uninstallation could not be completed.${RESET}"; exit 1' ERR
# Ensure the script runs with sudo
if [ "$EUID" -ne 0 ]; then
echo -e "${RED}This script requires root permissions. Please enter your password.${RESET}"
sudo bash "$0" "$@"
exit
fi
# Get the current username (this should match what was used during installation)
USERNAME=$(logname)
# Remove GRUB configuration changes
echo -e "${CYAN}Restoring GRUB configuration...${RESET}"
sed -i 's/^# GRUB_DEFAULT=0\nGRUB_DEFAULT=saved/GRUB_DEFAULT=0/' /etc/default/grub
sed -i 's/GRUB_TIMEOUT=3/#GRUB_TIMEOUT=5/' /etc/default/grub
update-grub
# Remove the reboot script
echo -e "${CYAN}Removing reboot script...${RESET}"
rm -f /opt/reboot-into-windows
# Remove sudoers configuration
echo -e "${CYAN}Removing sudo permissions...${RESET}"
rm -f /etc/sudoers.d/00-windows-reboot
# Remove desktop launcher
echo -e "${CYAN}Removing desktop launcher...${RESET}"
if [ -f "/home/$USERNAME/Desktop/reboot-into-windows.desktop" ]; then
rm -f "/home/$USERNAME/Desktop/reboot-into-windows.desktop"
else
echo -e "${YELLOW}Desktop launcher not found. It may have already been removed.${RESET}"
fi
# Success message
echo ""
echo -e "${GREEN}=========================================================${RESET}"
echo -e "🎉 ${GREEN}Uninstallation Complete!${RESET} 🎉"
echo ""
echo -e "All modifications have been reverted and files removed."
echo "You can safely delete the desktop shortcut if still present"
echo ""
echo -e "${GREEN}=========================================================${RESET}"
echo ""
wait_for_keypress