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 hooks/updatebase.GRMLBASE fails for whatever reason
13 # and can't skip instsoft.GRMLBASE we have to make sure
14 # we exit here as well
15 if [ -n "$BUILD_ONLY" ] ; then
16 "Exiting hooks/instsoft.GRMLBASE as BUILD_ONLY environment is set."
20 if [ "$FAI_ACTION" = "softupdate" ] ; then
21 echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
23 if [ -r /etc/resolv.conf ] ; then
24 if [ -d $target/etc/resolvconf/run ] ; then # resolvconf without /run
25 # sanity check to avoid "input file is output file",
26 # see http://bts.grml.org/grml/issue984
27 if ! [ -L $target/etc/resolvconf/run/resolv.conf ] ; then
28 cat /etc/resolv.conf >> $target/etc/resolvconf/run/resolv.conf
30 echo "Error: /etc/resolvconf/run/resolv.conf in chroot should not be a symlink." >&2
31 echo " Looks like something is wrong, please fix manually." >&2
34 elif [ -L $target/etc/resolvconf/run ] ; then # resolvconf with /run
35 # /etc/resolvconf/run symlinks to /run/resolvconf
36 mkdir -p $target/run/resolvconf
37 cat /etc/resolv.conf >> $target/run/resolvconf/resolv.conf
38 else # no resolvconf installed in chroot
39 if ! [ -L $target/etc/resolv.conf ] ; then
40 cat /etc/resolv.conf >> $target/etc/resolv.conf
42 echo "Error: /etc/resolv.conf in chroot should not be a symlink (resolvconf not installed)." >&2
48 if [ -r $target/etc/policy-rc.d.conf ] ; then
49 sed -i "s/EXITSTATUS=.*/EXITSTATUS='101'/" $target/etc/policy-rc.d.conf
52 # we definitely don't want to fail running fai sofupdate just
53 # because of some well known bugs:
54 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
55 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
56 // Check all packages whether they has critical bugs before they are installed.
57 // If you don't like it, comment it out.
58 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
59 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
60 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
63 # FAI softupdate executes upgrade only with the sources.list being
64 # present in the chroot - so let's do it on our own:
65 if [ -r /etc/grml/fai/apt/sources.list ] ; then
66 if [ -L $target/etc/apt/sources.list ] ; then
67 rm $target/etc/apt/sources.list
70 # install grml-live's (on the fly adjusted) sources.list config
71 cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list.d/grml-live.list
73 # when re-running grml-live with the -u option we do not want to use the
74 # sources.list config of the live system but grml-live's config instead,
75 # therefore temporarly move known files and restore them again later on
76 # through /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup:
77 if [ -r $target/etc/apt/sources.list.d/grml.list ] ; then
78 mv $target/etc/apt/sources.list.d/grml.list $target/etc/apt/sources.list.d/grml.unused
80 if [ -r $target/etc/apt/sources.list.d/debian.list ] ; then
81 mv $target/etc/apt/sources.list.d/debian.list $target/etc/apt/sources.list.d/debian.unused
85 # run it on our own, as updatebase is used at the wrong stage for our needs,
86 # see /etc/grml/fai/config/hooks/updatebase.GRMLBASE
87 # the apt-get update might return an error if there's for example
88 # a hashsum mismatch on Debian mirror sources, we might want to continue
89 # but should warn the user
90 if ! $ROOTCMD apt-get update ; then
91 echo "Warning: there was an error executing apt-get update, continuing anyway."
94 # newer aptitude versions won't remove essential packages using
95 # 'aptitude -f -y install file-rc' anymore, therefore force it:
96 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
98 if ! [ -x $target/usr/bin/aptitude ] ; then
99 $ROOTCMD apt-get -y install aptitude
102 if [ -x $target/usr/bin/aptitude ] ; then
103 if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
104 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y safe-upgrade
106 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y upgrade
109 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y upgrade
112 exit # make sure we don't continue behind the following "fi"
115 # no softupdate but fresh installation
116 echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
118 # make sure we have file-rc available before package_config/GRML* is being executed {{{
119 # the apt-get update might return an error if there's for example
120 # a hashsum mismatch on Debian mirror sources, we might want to continue
121 # but should warn the user
122 if ! $ROOTCMD apt-get update ; then
123 echo "Warning: there was an error executing apt-get update, continuing anyway."
124 echo "Warning: there was an error executing apt-get update, continuing anyway." >&2
127 # newer aptitude versions won't remove essential packages using
128 # 'aptitude -f -y install file-rc' anymore, therefore force it via:
129 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
132 # get rid of insserv:
133 if $ROOTCMD dpkg --list insserv 2>/dev/null | grep -q '^ii' ; then
134 $ROOTCMD apt-get -y --purge remove insserv
137 # we definitely don't want to fail running fai dirinstall just
138 # because of some well known bugs:
139 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
140 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
141 // Check all packages whether they has critical bugs before they are installed.
142 // If you don't like it, comment it out.
143 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
144 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
145 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
148 # make sure /dev/MAKEDEV is available:
149 if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then
150 ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV
153 # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)):
154 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
155 rm -f "$target"/usr/sbin/invoke-rc.d
156 $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
159 ## END OF FILE #################################################################
160 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2