2 # Filename: ${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 case "$(chroot $target readlink -f /etc/resolv.conf)" in
25 /run/*) # resolvconf with /run
26 mkdir -p $target/run/resolvconf
27 cat /etc/resolv.conf >> $target/run/resolvconf/resolv.conf
29 /lib/*) # resolvconf without /run
30 # sanity check to avoid "input file is output file",
31 # see http://bts.grml.org/grml/issue984
32 if ! [ -L $target/etc/resolvconf/run/resolv.conf ] ; then
33 cat /etc/resolv.conf >> $target/etc/resolvconf/run/resolv.conf
35 echo "Error: /etc/resolvconf/run/resolv.conf in chroot should not be a symlink." >&2
36 echo " Looks like something is wrong, please fix manually." >&2
41 if ! [ -L $target/etc/resolv.conf ] ; then
42 cat /etc/resolv.conf >> $target/etc/resolv.conf
44 echo "Error: /etc/resolv.conf in chroot should not be a symlink (resolvconf not installed)." >&2
51 if [ -r $target/etc/policy-rc.d.conf ] ; then
52 sed -i "s/EXITSTATUS=.*/EXITSTATUS='101'/" $target/etc/policy-rc.d.conf
55 # we definitely don't want to fail running fai sofupdate just
56 # because of some well known bugs:
57 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
58 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
59 // Check all packages whether they has critical bugs before they are installed.
60 // If you don't like it, comment it out.
61 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
62 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
63 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
66 # work around /etc/kernel/postinst.d/zz-update-grub failing
67 # inside openvz environment, see #597084
68 if ! $ROOTCMD dpkg-divert --list | grep -q '/usr/sbin/update-grub' ; then
69 echo "Diverting update-grub executable"
70 $ROOTCMD dpkg-divert --rename --add /usr/sbin/update-grub
71 $ROOTCMD ln -s /bin/true /usr/sbin/update-grub
74 # newer aptitude versions won't remove essential packages using
75 # 'aptitude -f -y install file-rc' anymore, therefore force it:
76 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
78 if ! $ROOTCMD test -x /usr/bin/aptitude ; then
79 $ROOTCMD apt-get -y install aptitude
82 # make sure we can upgrade automatically,
83 # even with unsigned repos, but only if user wants it
84 if [ "${FAI_ALLOW_UNSIGNED:-}" = "1" ] ; then
85 APTGET_OPTS="${APTGET_OPTS:-} --allow-unauthenticated"
86 APTITUDE_OPTS="${APTITUDE_OPTS:-} --allow-untrusted"
89 if $ROOTCMD test -x /usr/bin/aptitude ; then
90 if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
91 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS safe-upgrade
93 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS upgrade
96 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y $APTGET_OPTS --force-yes upgrade
99 exit # make sure we don't continue behind the following "fi"
102 # no softupdate but fresh installation
103 echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
105 # make sure we have file-rc available before package_config/GRML* is being executed {{{
106 # the apt-get update might return an error if there's for example
107 # a hashsum mismatch on Debian mirror sources, we might want to continue
108 # but should warn the user
109 if ! $ROOTCMD apt-get update ; then
110 echo "Warning: there was an error executing apt-get update, continuing anyway."
111 echo "Warning: there was an error executing apt-get update, continuing anyway." >&2
114 # newer aptitude versions won't remove essential packages using
115 # 'aptitude -f -y install file-rc' anymore, therefore force it via:
116 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
119 # get rid of insserv:
120 if $ROOTCMD dpkg --list insserv 2>/dev/null | grep -q '^ii' ; then
121 $ROOTCMD apt-get -y --purge remove insserv
124 # we definitely don't want to fail running fai dirinstall just
125 # because of some well known bugs:
126 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
127 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
128 // Check all packages whether they has critical bugs before they are installed.
129 // If you don't like it, comment it out.
130 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
131 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
132 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
135 # make sure /dev/MAKEDEV is available:
136 if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then
137 ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV
140 # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)):
141 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
142 rm -f "$target"/usr/sbin/invoke-rc.d
143 $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
146 ## END OF FILE #################################################################
147 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2