Make all shell scripts using /bin/bash instead /bin/sh to be able to FAI's environment.
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 96-apt-listbugs
1 #!/bin/bash
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 ################################################################################
8
9 set -e
10
11 if [ -r $target/etc/apt/apt.conf.d/10apt-listbugs ] ; then
12    if [ -x $target/usr/sbin/apt-listbugs ] ; then
13       sed -i 's#//DPkg::#DPkg::#' $target/etc/apt/apt.conf.d/10apt-listbugs
14    fi
15 fi
16
17 if ifclass RELEASE ; then
18
19   HOSTNAME=''
20   [ -r /etc/grml/grml-live.conf ]  && . /etc/grml/grml-live.conf
21   [ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
22   [ -n "$HOSTNAME" ] || HOSTNAME=grml
23
24   if [ -r /etc/resolv.conf ] ; then
25      if [ -d $target/etc/resolvconf/run ] ; then
26         cat /etc/resolv.conf >> $target/etc/resolvconf/run/resolv.conf
27      elif [ ! -L $target/etc/resolv.conf ] ; then
28         cat /etc/resolv.conf >> $target/etc/resolv.conf
29      fi
30   fi
31
32   if [ -x $target/usr/sbin/apt-listbugs -a -x $target/usr/bin/apt-show-source ] && \
33      [ -x $target/etc/apt/grml/listbugs ] ; then
34      for severity in critical grave serious ; do
35          SEVERITY=$severity $ROOTCMD /etc/apt/grml/listbugs > \
36          /var/log/fai/$HOSTNAME/last/bugs.${severity} || true # make sure it does not fail
37      done
38   fi
39
40 fi
41
42 ## END OF FILE #################################################################