blob: e391e1d948ce88b5abe2aa5426871361f903b55c (
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
|
_tp_config="/etc/npreal2/npreal2d.cf"
_tp_configps="${_tp_config}.pacsave"
_tp_log='/var/log/npreal2d.log'
post_upgrade() {
set -u
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
if [ ! -d /usr/src/npreal2-*/ ]; then
systemctl stop 'npreal2.service' # also rmmod the module
fi
set +u
}
pre_remove() {
set -u
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
systemctl daemon-reload
set +u
}
|