-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_uninstall.sh
More file actions
executable file
·43 lines (35 loc) · 1.41 KB
/
user_uninstall.sh
File metadata and controls
executable file
·43 lines (35 loc) · 1.41 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
#!/bin/bash
# User-level uninstallation script for idle_detect service
# Run this script AS YOUR REGULAR USER before running 'sudo ./uninstall.sh'.
# --- Configuration ---
USER_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
USER_CONFIG_DEST="${USER_CONFIG_HOME}/idle_detect.conf"
SERVICE_NAME="dc_idle_detection.service"
# --- End Configuration ---
echo "--- Starting User-Level Uninstallation ---"
# --- Disable and Stop User Service ---
echo "INFO: Disabling and stopping user service '$SERVICE_NAME'..."
# Use || true to ignore errors if service doesn't exist or isn't active/enabled
systemctl --user disable --now "$SERVICE_NAME" || true
# --- Optionally Remove User Config File ---
if [ -f "$USER_CONFIG_DEST" ]; then
read -p "Remove user configuration file ($USER_CONFIG_DEST)? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
echo "INFO: Removing user configuration file: $USER_CONFIG_DEST"
rm -f "$USER_CONFIG_DEST"
;;
*)
echo "INFO: Skipping removal of user configuration file."
;;
esac
fi
# --- Systemd User Daemon Reload ---
echo "INFO: Reloading systemd user instance..."
systemctl --user daemon-reload
echo ""
echo "--- User-Level Uninstallation Complete ---"
echo "User service stopped/disabled and files removed (config removal based on prompt)."
echo "Now run 'sudo ./uninstall.sh' to remove system components."
echo ""
exit 0