-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsynps-mouse-led.install
More file actions
69 lines (64 loc) · 1.46 KB
/
Copy pathsynps-mouse-led.install
File metadata and controls
69 lines (64 loc) · 1.46 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
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
_detect_init() {
if [ -d /run/systemd/system ]; then
echo "systemd"
elif [ -x /sbin/openrc-run ]; then
echo "openrc"
elif [ -d /etc/runit ]; then
echo "runit"
elif [ -f /etc/init.d/synps-led-daemon-sysvinit ]; then
echo "sysvinit"
else
echo "unknown"
fi
}
_enable_service() {
local init=$(_detect_init)
case "$init" in
systemd)
systemctl daemon-reload
systemctl enable --now synps-led-daemon.service 2>/dev/null || true
;;
openrc)
rc-update add synps-led-daemon default 2>/dev/null || true
rc-service synps-led-daemon start 2>/dev/null || true
;;
runit)
ln -sf /etc/runit/sv/synps-led-daemon /var/service/ 2>/dev/null || true
;;
sysvinit)
update-rc.d synps-led-daemon-sysvinit defaults 2>/dev/null || true
/etc/init.d/synps-led-daemon-sysvinit start 2>/dev/null || true
;;
esac
}
_disable_service() {
local init=$(_detect_init)
case "$init" in
systemd)
systemctl disable --now synps-led-daemon.service 2>/dev/null || true
;;
openrc)
rc-service synps-led-daemon stop 2>/dev/null || true
rc-update del synps-led-daemon default 2>/dev/null || true
;;
runit)
rm -f /var/service/synps-led-daemon 2>/dev/null || true
;;
sysvinit)
/etc/init.d/synps-led-daemon-sysvinit stop 2>/dev/null || true
update-rc.d synps-led-daemon-sysvinit remove 2>/dev/null || true
;;
esac
}
post_install() {
depmod
_enable_service
}
post_upgrade() {
depmod
_enable_service
}
post_remove() {
_disable_service
depmod
}