Merge remote-tracking branch 'origin/github/pr/145'
[grml-live.git] / etc / grml / fai / config / scripts / DEBORPHAN / 10-whitelist
1 #!/bin/bash
2 # Filename:      ${GRML_FAI_CONFIG}/config/scripts/DEBORPHAN/10-whitelist
3 # Purpose:       whitelist packages to keep with deborphan
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 ################################################################################
8
9 set -u
10 set -e
11
12 # workaround for dnsutils transitional package, we can drop this as soon as the
13 # bind9-dnsutils package is available in all our supported Debian releases
14 if [[ -r "${target}/usr/share/doc/dnsutils" ]] && [ -x "${target}/usr/bin/deborphan" ] ; then
15   echo "Adding dnsutils to deborphan whitelist"
16   # workaround for https://bugs.debian.org/929273 ("fseek on /var/lib/deborphan/keep: Invalid argument")
17   if ! [ -f "${target}"/var/lib/deborphan/keep ] ; then
18     printf 'dnsutils\n' > "${target}"/var/lib/deborphan/keep
19   elif grep -q '^dnsutils$' "${target}"/var/lib/deborphan/keep ; then
20     : # entry already present, avoid duplicates
21   else
22     printf 'dnsutils\n' >> "${target}"/var/lib/deborphan/keep
23   fi
24 fi
25
26 # workaround for bsdmainutils transitional package, we can drop this as soon as the
27 # bsdextrautils + ncal packages are available in all our supported Debian releases
28 if [[ -r "${target}/usr/share/doc/bsdmainutils" ]] && [ -x "${target}/usr/bin/deborphan" ] ; then
29   echo "Adding bsdmainutils to deborphan whitelist"
30   # workaround for https://bugs.debian.org/929273 ("fseek on /var/lib/deborphan/keep: Invalid argument")
31   if ! [ -f "${target}"/var/lib/deborphan/keep ] ; then
32     printf 'bsdmainutils\n' > "${target}"/var/lib/deborphan/keep
33   elif grep -q '^bsdmainutils$' "${target}"/var/lib/deborphan/keep ; then
34     : # entry already present, avoid duplicates
35   else
36     printf 'bsdmainutils\n' >> "${target}"/var/lib/deborphan/keep
37   fi
38 fi
39
40 ## END OF FILE #################################################################
41 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2