# bind9-dnsutils package is available in all our supported Debian releases
if [[ -r "${target}/usr/share/doc/dnsutils" ]] && [ -x "${target}/usr/bin/deborphan" ] ; then
echo "Adding dnsutils to deborphan whitelist"
- $ROOTCMD deborphan --add-keep dnsutils || /bin/true
+ # workaround for https://bugs.debian.org/929273 ("fseek on /var/lib/deborphan/keep: Invalid argument")
+ 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 #################################################################