diff options
author | Tomas Krizek <tomas.krizek@nic.cz> | 2020-01-22 12:23:30 +0100 |
---|---|---|
committer | Tomas Krizek <tomas.krizek@nic.cz> | 2020-01-24 13:19:06 +0100 |
commit | aeced046a018400b80ffd02b492fa7e7e0523c49 (patch) | |
tree | 22507997a9cf311c700df93dfd270711ef8e15fe /distro | |
parent | distro/deb: use daemon-reload to update units before restart (diff) | |
download | knot-resolver-aeced046a018400b80ffd02b492fa7e7e0523c49.tar.xz knot-resolver-aeced046a018400b80ffd02b492fa7e7e0523c49.zip |
distro/deb: save systemd socket conf before http module uninstall
Diffstat (limited to 'distro')
-rw-r--r-- | distro/deb/knot-resolver-module-http.preinst | 25 | ||||
-rw-r--r-- | distro/deb/knot-resolver.preinst | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/distro/deb/knot-resolver-module-http.preinst b/distro/deb/knot-resolver-module-http.preinst new file mode 100644 index 00000000..72746106 --- /dev/null +++ b/distro/deb/knot-resolver-module-http.preinst @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +# upgrade-4-to-5 +if [ -f /lib/systemd/system/kresd-doh.socket ] ; then + export UPG_DIR=/var/lib/knot-resolver/.upgrade-4-to-5 + mkdir -p ${UPG_DIR} + touch ${UPG_DIR}/.unfinished + + for sock in kresd-webmgmt.socket kresd-doh.socket ; do + if systemctl is-enabled ${sock} 2>/dev/null | grep -qv masked ; then + systemctl show ${sock} -p Listen > ${UPG_DIR}/${sock} + case "$(systemctl show ${sock} -p BindIPv6Only)" in + *ipv6-only) + touch ${UPG_DIR}/${sock}.v6only + ;; + *default) + if cat /proc/sys/net/ipv6/bindv6only | grep -q 1 ; then + touch ${UPG_DIR}/${sock}.v6only + fi + ;; + esac + fi + done +fi diff --git a/distro/deb/knot-resolver.preinst b/distro/deb/knot-resolver.preinst index 568ade24..3d970799 100644 --- a/distro/deb/knot-resolver.preinst +++ b/distro/deb/knot-resolver.preinst @@ -7,7 +7,7 @@ if [ -f /lib/systemd/system/kresd.socket ] ; then mkdir -p ${UPG_DIR} touch ${UPG_DIR}/.unfinished - for sock in kresd.socket kresd-tls.socket kresd-webmgmt.socket kresd-doh.socket ; do + for sock in kresd.socket kresd-tls.socket ; do if systemctl is-enabled ${sock} 2>/dev/null | grep -qv masked ; then systemctl show ${sock} -p Listen > ${UPG_DIR}/${sock} case "$(systemctl show ${sock} -p BindIPv6Only)" in |