2 # Filename: /etc/grml/fai/config/hooks/instsoft.GRMLBASE
3 # Purpose: Grml specific software installation in the chroot, executed after updatebase
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 ################################################################################
12 if [ "$FAI_ACTION" = "softupdate" ] ; then
13 echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
15 if [ -r /etc/resolv.conf ] ; then
16 if [ -r $target/etc/resolvconf/run/resolv.conf ] ; then
17 cat /etc/resolv.conf >> $target/etc/resolvconf/run/resolv.conf
19 cat /etc/resolv.conf >> $target/etc/resolv.conf
23 if [ -r $target/etc/policy-rc.d.conf ] ; then
24 sed -i "s/EXITSTATUS=.*/EXITSTATUS='101'/" $target/etc/policy-rc.d.conf
27 # we definitely don't want to fail running fai sofupdate just
28 # because of some well known bugs:
29 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
30 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
31 // Check all packages whether they has critical bugs before they are installed.
32 // If you don't like it, comment it out.
33 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
34 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
35 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
38 # FAI softupdate executes upgrade only with the sources.list being
39 # present in the chroot - so let's do it on our own:
40 if [ -r /etc/grml/fai/apt/sources.list ] ; then
41 if [ -L $target/etc/apt/sources.list ] ; then
42 rm $target/etc/apt/sources.list
45 # install grml-live's (on the fly adjusted) sources.list config
46 cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list.d/grml-live.list
48 # when re-running grml-live with the -u option we do not want to use the
49 # sources.list config of the live system but grml-live's config instead,
50 # therefore temporarly move known files and restore them again later on
51 # through /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup:
52 if [ -r $target/etc/apt/sources.list.d/grml.list ] ; then
53 mv $target/etc/apt/sources.list.d/grml.list $target/etc/apt/sources.list.d/grml.unused
55 if [ -r $target/etc/apt/sources.list.d/debian.list ] ; then
56 mv $target/etc/apt/sources.list.d/debian.list $target/etc/apt/sources.list.d/debian.unused
60 # run it on our own, as updatebase is used at the wrong stage for our needs,
61 # see /etc/grml/fai/config/hooks/updatebase.GRMLBASE
62 # the apt-get update might return an error if there's for example
63 # a hashsum mismatch on Debian mirror sources, we might want to continue
64 # but should warn the user
65 if ! $ROOTCMD apt-get update ; then
66 echo "Warning: there was an error executing apt-get update, continuing anyway."
69 # newer aptitude versions won't remove essential packages using
70 # 'aptitude -f -y install file-rc' anymore, therefore force it:
71 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
73 if ! [ -x $target/usr/bin/aptitude ] ; then
74 $ROOTCMD apt-get -y install aptitude
77 if [ -x $target/usr/bin/aptitude ] ; then
78 if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
79 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y safe-upgrade
81 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y upgrade
84 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y upgrade
87 exit # make sure we don't continue behind the following "fi"
90 # no softupdate but fresh installation
91 echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
93 # make sure we have file-rc available before package_config/GRML* is being executed {{{
94 # the apt-get update might return an error if there's for example
95 # a hashsum mismatch on Debian mirror sources, we might want to continue
96 # but should warn the user
97 if ! $ROOTCMD apt-get update ; then
98 echo "Warning: there was an error executing apt-get update, continuing anyway."
99 echo "Warning: there was an error executing apt-get update, continuing anyway." >&2
102 # newer aptitude versions won't remove essential packages using
103 # 'aptitude -f -y install file-rc' anymore, therefore force it via:
104 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
107 # get rid of insserv:
108 if $ROOTCMD dpkg --list insserv 2>/dev/null | grep -q '^ii' ; then
109 $ROOTCMD apt-get -y --purge remove insserv
112 # we definitely don't want to fail running fai dirinstall just
113 # because of some well known bugs:
114 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
115 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
116 // Check all packages whether they has critical bugs before they are installed.
117 // If you don't like it, comment it out.
118 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
119 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
120 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
123 # make sure /dev/MAKEDEV is available:
124 if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then
125 ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV
128 # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)):
129 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
130 rm -f "$target"/usr/sbin/invoke-rc.d
131 $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
134 ## END OF FILE #################################################################
135 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3