From cb6179feeefcd3aed4b3812d54f734a8efe6179b Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 20 May 2020 16:10:29 +0200 Subject: [PATCH] DEBORPHAN/10-whitelist: rework fix for broken keep file handling of deborphan An empty file doesn't help either, so we need at least a file with a newline. Given that we're already touching the file based on its hard-coded filename, let's just append the package in question and avoid invoking deborphan at all. Especially as deborphan returns with failure when a package is already listed: | deborphan: dnsutils: duplicate entry. We need to handle this anyway, if grml-live is re-executed on an existing system (which isn't unusual). --- etc/grml/fai/config/scripts/DEBORPHAN/10-whitelist | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/etc/grml/fai/config/scripts/DEBORPHAN/10-whitelist b/etc/grml/fai/config/scripts/DEBORPHAN/10-whitelist index 0c145f7..a689fec 100755 --- a/etc/grml/fai/config/scripts/DEBORPHAN/10-whitelist +++ b/etc/grml/fai/config/scripts/DEBORPHAN/10-whitelist @@ -14,8 +14,13 @@ set -e if [[ -r "${target}/usr/share/doc/dnsutils" ]] && [ -x "${target}/usr/bin/deborphan" ] ; then echo "Adding dnsutils to deborphan whitelist" # workaround for https://bugs.debian.org/929273 ("fseek on /var/lib/deborphan/keep: Invalid argument") - $ROOTCMD touch /var/lib/deborphan/keep - $ROOTCMD deborphan --add-keep dnsutils + if ! [ -f "${target}"/var/lib/deborphan/keep ] ; then + printf 'dnsutils\n' > "${target}"/var/lib/deborphan/keep + elif grep -q '^dnsutils$' "${target}"/var/lib/deborphan/keep ; then + : # entry already present, avoid duplicates + else + printf 'dnsutils\n' >> "${target}"/var/lib/deborphan/keep + fi fi ## END OF FILE ################################################################# -- 2.1.4