-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
uninstall_service.sh
43 lines (35 loc) · 1.09 KB
/
uninstall_service.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
#!/usr/bin/env bash
source non_sudo_check.sh
# ENV VARS
if [ -z "$SERVICE_INSTALL_DIR_PATH" ]; then
SERVICE_INSTALL_DIR_PATH="/usr/lib/systemd/user"
fi
SERVICE_INSTALL_FILE_NAME="[email protected]"
SERVICE_INSTANCE_FILE_NAME="asus_numberpad_driver@$USER.service"
systemctl --user stop "$SERVICE_INSTANCE_FILE_NAME"
if [[ $? != 0 ]]
then
echo "Something went wrong when stopping the $SERVICE_INSTANCE_FILE_NAME"
else
echo "Service $SERVICE_INSTANCE_FILE_NAME stopped"
fi
systemctl --user disable "$SERVICE_INSTANCE_FILE_NAME"
if [[ $? != 0 ]]
then
echo "Something went wrong when disabling the $SERVICE_INSTANCE_FILE_NAME"
else
echo "Service $SERVICE_INSTANCE_FILE_NAME disabled"
fi
sudo rm -f "$SERVICE_INSTALL_DIR_PATH/$SERVICE_INSTALL_FILE_NAME"
if [[ $? != 0 ]]
then
echo "Something went wrong when removing the $SERVICE_INSTALL_FILE_NAME"
else
echo "Service $SERVICE_INSTANCE_FILE_NAME removed"
fi
systemctl --user daemon-reload
if [[ $? != 0 ]]; then
echo "Something went wrong when was called systemctl daemon reload"
else
echo "Systemctl daemon reloaded"
fi