-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathuninstall.sh
executable file
·43 lines (35 loc) · 1.07 KB
/
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
#!/bin/bash
# The UID variable is only available in bash
if [ $UID -ne 0 ]; then
echo "This script needs to be run as root"
exit 1
fi
echo "Disabling autostart"
if ! systemctl disable phosh-renice; then
echo "Failed to disable the phosh-renice service, aborting"
exit 1
fi
# This might be unneccesary and not work for one-shot services
echo "Stopping service"
if ! systemctl stop phosh-renice; then
echo "Failed to stop the phosh-renice service, aborting"
exit 1
fi
echo "Removing files..."
if ! rm /usr/local/sbin/phosh_renice; then
echo "Failed to remove /usr/local/sbin/phosh_renice, aborting"
exit 1
fi
if ! rm /etc/systemd/system/phosh-renice.service; then
echo "Failed to remove /etc/systemd/system/phosh-renice.service, aborting"
exit 1
fi
# Remove /usr/local/sbin if it's empty (probably created by the install script)
if [ -z /usr/local/sbin ]; then
echo "Directory /usr/local/sbin is empty, removing..."
if ! rm -r /usr/local/sbin; then
echo "Failed to remove /usr/local/sbin, aborting"
exit 1
fi
fi
echo "Successfully uninstalled the phosh-renice service."