From 68f64dc69a72d9242ee39db28bc04fc3efda99a2 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 21 Aug 2022 02:01:40 +0100 Subject: [PATCH] resolved: use DPKG_ROOT and make postinst shellcheck-happy --- debian/systemd-resolved.postinst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/debian/systemd-resolved.postinst b/debian/systemd-resolved.postinst index 17ab95726..f06f149a6 100644 --- a/debian/systemd-resolved.postinst +++ b/debian/systemd-resolved.postinst @@ -6,15 +6,15 @@ _adopt_conffile() { conffile=$1 pkg=$2 - [ -f ${conffile}.dpkg-bak ] || return 0 + [ -f "${conffile}.dpkg-bak" ] || return 0 - md5sum="$(md5sum ${conffile} | sed -e 's/ .*//')" - old_md5sum="$(dpkg-query -W -f='${Conffiles}' $pkg | \ + md5sum="$(md5sum "${conffile}" | sed -e 's/ .*//')" + old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$pkg" | \ sed -n -e "\' ${conffile} ' { s/ obsolete$//; s/.* //; p }")" # On new installs, if the policy file was preserved on systemd upgrade # by dpkg-maintscript helper, copy it back if the new file has not been modified yet if [ "$md5sum" = "$old_md5sum" ]; then - mv ${conffile}.dpkg-bak ${conffile} + mv "${conffile}.dpkg-bak" "${conffile}" fi } @@ -22,7 +22,7 @@ _adopt_conffile() { if [ "$1" = configure ] && [ -z "$2" ]; then adduser --quiet --system --group --no-create-home --home /run/systemd \ --gecos "systemd Resolver" systemd-resolve - _adopt_conffile /etc/systemd/resolved.conf systemd-resolved + _adopt_conffile "${DPKG_ROOT}/etc/systemd/resolved.conf" systemd-resolved fi #DEBHELPER#