blob: 073ed9e0b77b426b1de47ff11aafa021c15f2088 (
plain)
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
|
_tp_config="/etc/npreal2/npreal2d.cf"
_tp_configps="${_tp_config}.pacsave"
#_tp_log='/var/log/npreal2d.log'
# It's the only way to be sure
_nuke_it_from_orbit() {
# Remove broken systemd support placed by mxloadsvr.c
rm -f '/etc/systemd/system/npreal2.service'
}
post_upgrade() {
set -u
_nuke_it_from_orbit
systemctl daemon-reload
# Handle the module update if DKMS doesn't
if [ ! -d /usr/src/npreal2-*/ ]; then
depmod -a
if systemctl -q is-enabled 'npreal2.service'; then
systemctl start 'npreal2.service'
fi
fi
set +u
}
post_install() {
set -u
if [ -f "${_tp_config}" ] && [ -f "${_tp_configps}" ] && ! grep -q '^[0-9]' "${_tp_config}" && grep -q '^[0-9]' "${_tp_configps}"; then
mv "${_tp_configps}" "${_tp_config}"
fi
set +u
post_upgrade
if systemctl -q is-enabled 'npreal2.service' && ! systemctl -q is-active 'npreal2.service'; then
# We can't auto start the service because DKMS hasn't made the module yet
echo 'Please start the service with'
echo " systemctl start 'npreal2.service'"
fi
}
pre_upgrade() {
set -u
_nuke_it_from_orbit
if [ ! -d /usr/src/npreal2-*/ ]; then
systemctl stop 'npreal2.service' # also rmmod the module
fi
set +u
}
pre_remove() {
set -u
_nuke_it_from_orbit
systemctl stop 'npreal2.service' # pre_upgrade
# Unfortunately this when blank is changed after install which makes pacman think that it needs to be saved
if ! grep -q '^[0-9]' "${_tp_config}"; then
rm -f "${_tp_config}"
fi
set +u
}
post_remove() {
set -u
_nuke_it_from_orbit
systemctl daemon-reload
set +u
}
|