From 6b2e23da6d77bcddd6f3bca595ec053eac2e9204 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 29 May 2020 14:57:56 +0200 Subject: [PATCH] GRMLBASE/98-clean-chroot: avoid warning messages with resolvconf <1.80 In commit acf12d4123bd68f we got rid of /etc/resolvconf/run, and while resolvconf >=1.80 no longer uses /etc/resolvconf/run, older versions of resolvconf still use it in their libc update hook script. :-/ So while it really works e.g. on Debian/buster (as documented in commit acf12d4123bd68f) with resolvconf v1.79, there's an ugly: | /etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /etc/resolvconf/run/resolv.conf" for resolvconf versions message when invoking "dhclient". Try to avoid this. Related to https://github.com/grml/grml/issues/142 --- .../fai/config/scripts/GRMLBASE/98-clean-chroot | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot b/etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot index f293e910e..a00ebd676 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot +++ b/etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot @@ -189,7 +189,20 @@ else echo "Setting up resolvconf" rm -f "${target}"/etc/resolvconf/resolv.conf.d/original rm -f "${target}"/etc/resolv.conf - ln -s /run/resolvconf/resolv.conf "${target}"/etc/resolv.conf + + # avoid "/etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a + # symbolic link to /etc/resolvconf/run/resolv.conf" for resolvconf versions + # before 1.80 + RESOLVCONF_VERSION=$($ROOTCMD dpkg-query -W -f='${Version}\n' resolvconf || true) + echo "-> Identified resolvconf version '${RESOLVCONF_VERSION}'" + if dpkg --compare-versions "${RESOLVCONF_VERSION}" lt 1.80 ; then + echo "-> Installing resolvconf symlink for versions <1.80" + ln -s /etc/resolvconf/run/resolv.conf "${target}"/etc/resolv.conf + else + echo "-> Installing resolvconf symlink for versions >=1.80" + ln -s /run/resolvconf/resolv.conf "${target}"/etc/resolv.conf + fi + fi # make sure we don't leak any mdadm configurations