blob: 8dbb56e61873cb06a3c77ca7cd4c56f3fe107bf4 (
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
|
_service='ipsec.service'
_pkgname='libreswan'
post_upgrade() {
if ! systemctl -q is-enabled "${_service}"; then
echo " systemctl enable '${_service}'"
fi
if ! systemctl -q is-active "${_service}"; then
echo " systemctl start '${_service}'"
else
echo " systemctl restart '${_service}'"
fi
if [ "$(vercmp "${1}" '4.0')" -ge 0 ]; then
if [ -s '/etc/ipsec.d/cert9.db' ]; then
echo '>>> upgrading /var/lib/ipsec/nss'
set -x
ipsec checknss
set +x
fi
elif [ -d '/var/lib/ipsec/nss' ]; then
echo '>>> downgrading /var/lib/ipsec/nss'
set -x
mv '/var/lib/ipsec/nss'/* '/etc/ipsec.d/'
rmdir --ignore-fail-on-non-empty /var/lib/ipsec{/nss,}
set +x
fi
}
post_install() {
sysctl -p "/usr/lib/sysctl.d/${_pkgname}-icmp-redirects.conf"
echo ' ipsec verify'
post_upgrade
}
pre_remove() {
if systemctl -q is-active "${_service}"; then
echo " systemctl stop '${_service}'"
fi
if systemctl -q is-enabled "${_service}"; then
echo " systemctl disable '${_service}'"
fi
sysctl -p "/usr/lib/sysctl.d/${_pkgname}-icmp-redirects.conf.revert"
}
post_remove() {
if [ -d '/var/lib/ipsec/nss' ]; then
echo 'To complete package removal'
echo ' rm -r /var/lib/ipsec/nss'
fi
}
|