forked from NeroReflex/ROGueENEMY
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchimera_uninstall.sh
55 lines (43 loc) · 1.33 KB
/
chimera_uninstall.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
#!/bin/bash
# Define the user's home directory
# This is needed to find the installed executable in the user's home directory
if [ "$SUDO_USER" ]; then
HOME_DIR=$(getent passwd "$SUDO_USER" | cut -d: -f6)
else
HOME_DIR=$HOME
fi
# Define variables
INSTALL_DIR="$HOME_DIR/.local/bin"
SYSTEMD_DIR="/etc/systemd/system"
UDEV_RULES_DIR="/etc/udev/rules.d"
CONFIG_DIR="/etc/ROGueENEMY"
echo "Starting uninstallation of ROGueENEMY..."
# Ensure running as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root." >&2
exit 1
fi
# Stop and disable the systemd service
echo "Disabling and stopping the systemd service..."
systemctl stop rogue-enemy.service
systemctl disable rogue-enemy.service
rm -f "$SYSTEMD_DIR/rogue-enemy.service"
echo "Enabling handycon..."
systemctl enable --now handycon.service
# Remove the executable
echo "Removing the executable..."
rm -f "$INSTALL_DIR/rogue-enemy"
# Remove udev rules
echo "Removing udev rules..."
rm -f "$UDEV_RULES_DIR/99-rogue.rules"
rm -f "$UDEV_RULES_DIR/99-disable-sonypad.rules"
# Remove configuration directory
echo "Removing configuration files..."
rm -rf "$CONFIG_DIR"
# Reload system daemons and udev rules
echo "Reloading system daemons and udev rules..."
systemctl daemon-reload
udevadm control --reload-rules
udevadm trigger
# Cleanup
echo "Uninstallation complete."