Do not enable apt-listbugs if the binary is not available
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 96-apt-listbugs
1 #!/bin/sh
2 # Filename:      /etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs
3 # Purpose:       retreive list of bugreports of installed packages inside chroot
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 # Latest change: Mon Nov 19 12:49:27 CET 2007 [mika]
8 ################################################################################
9
10 set -e
11
12 # Defaults:
13 #apt-listchanges apt-listchanges/confirm boolean false
14 #apt-listchanges apt-listchanges/email-address   string  root
15 #apt-listchanges apt-listchanges/which   select  news
16 #apt-listchanges apt-listchanges/frontend        select  pager
17 #apt-listchanges apt-listchanges/save-seen       boolean true
18 if [ -x $target/usr/bin/apt-listchanges ] ; then
19    echo 'apt-listchanges apt-listchanges/confirm boolean true' | $ROOTCMD debconf-set-selections
20    echo 'apt-listchanges apt-listchanges/which   select  both' | $ROOTCMD debconf-set-selections
21 fi
22
23 if [ -r $target/etc/apt/apt.conf.d/10apt-listbugs ] ; then
24    if [ -x $target/usr/sbin/apt-listbugs ] ; then
25       sed -i 's#//DPkg::#DPkg::#' $target/etc/apt/apt.conf.d/10apt-listbugs
26    fi
27 fi
28
29 if ifclass RELEASE ; then
30
31   HOSTNAME=''
32   [ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
33   [ -n "$HOSTNAME" ] || HOSTNAME=grml
34
35   if [ -r /etc/resolv.conf ] ; then
36      if [ -r $target/etc/resolvconf/run/resolv.conf ] ; then
37         cat /etc/resolv.conf >> $target/etc/resolvconf/run/resolv.conf
38      else
39         cat /etc/resolv.conf >> $target/etc/resolv.conf
40      fi
41   fi
42
43   if [ -x $target/usr/sbin/apt-listbugs -a -x $target/usr/bin/apt-show-source ] && \
44      [ -x $target/etc/apt/grml/listbugs ] ; then
45      for severity in critical grave serious ; do
46          SEVERITY=$severity $ROOTCMD /etc/apt/grml/listbugs > \
47          /var/log/fai/dirinstall/$HOSTNAME/bugs.${severity} || true # make sure it does not fail
48      done
49   fi
50
51 fi
52
53 ## END OF FILE #################################################################