-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkapudan-rootactions
executable file
·118 lines (99 loc) · 2.62 KB
/
kapudan-rootactions
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
echo "==> KAPUDAN <=="
echo "Performing root actions..."
enable_notifier() {
echo " Adding octopi-notifier to autostart apps..."
install -Dm755 /usr/share/applications/octopi-notifier.desktop \
/usr/share/autostart/octopi-notifier.desktop
echo " Done."
}
disable_notifier() {
echo " Removing octopi-notifier from autostart apps..."
rm /usr/share/autostart/octopi-notifier.desktop
echo " Done."
}
enable_daemon() {
# internal function, $1 is daemon to enable
systemctl enable $1
systemctl start $1
}
disable_daemon() {
# internal function, $1 is daemon to disable
systemctl disable $1
systemctl stop $1
}
enable_repo() {
# internal function, $1 is repo to enable
sed -i "/^#\[$1\]/,/^#/s/#//" /etc/pacman.conf
}
disable_repo() {
# internal function, $1 is repo to disable
sed -i "/^\[$1\]/,/^Include/s/^/#/" /etc/pacman.conf
}
enable_cups() {
echo " Enabling the CUPS printing service..."
enable_daemon org.cups.cupsd
enable_daemon cups-browsed
echo " Done."
}
disable_cups() {
echo " Disabling the CUPS printing service..."
disable_daemon org.cups.cupsd
disable_daemon cups-browsed
echo " Done."
}
enable_blue() {
echo " Enabling the Bluetooth service..."
enable_daemon bluetooth
echo " Done."
}
disable_blue() {
echo " Disabling the Bluetooth service..."
disable_daemon bluetooth
echo " Done."
}
enable_clam() {
echo " Enabling the ClamAV service..."
enable_daemon clamd
enable_daemon freshclamd
echo " Done."
}
disable_clam() {
echo " Disabling the ClamAV service..."
disable_daemon clamd
disable_daemon freshclamd
echo " Done."
}
enable_fire() {
echo " Enabling the UFW firewall..."
enable_daemon ufw
ufw enable
echo " Done."
}
disable_fire() {
echo " Disabling the UFW firewall..."
disable_daemon ufw
ufw disable
echo " Done."
}
if ! [[ $UID == 0 || $EUID == 0 ]]; then
# not root
echo "must be root"
exit 1
fi
# argument parsing
echo "$@" | grep -q "enable_notifier" && enable_notifier
echo "$@" | grep -q "disable_notifier" && disable_notifier
echo "$@" | grep -q "enable_cups" && enable_cups
echo "$@" | grep -q "disable_cups" && disable_cups
echo "$@" | grep -q "enable_blue" && enable_blue
echo "$@" | grep -q "disable_blue" && disable_blue
echo "$@" | grep -q "enable_clam" && enable_clam
echo "$@" | grep -q "disable_clam" && disable_clam
echo "$@" | grep -q "enable_fire" && enable_fire
echo "$@" | grep -q "disable_fire" && disable_fire
# all done
echo "All done!"
echo "Press Enter to continue."
read me
exit