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 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 # run it on our own, as updatebase is used at the wrong stage for our needs,
64 # see ${GRML_FAI_CONFIG}/hooks/updatebase.GRMLBASE
65 # the apt-get update might return an error if there's for example
66 # a hashsum mismatch on Debian mirror sources, we might want to continue
67 # but should warn the user
68 if ! $ROOTCMD apt-get update ; then
69 echo "Warning: there was an error executing apt-get update, continuing anyway."
72 # work around /etc/kernel/postinst.d/zz-update-grub failing
73 # inside openvz environment, see #597084
74 if ! $ROOTCMD dpkg-divert --list | grep -q '/usr/sbin/update-grub' ; then
75 echo "Diverting update-grub executable"
76 $ROOTCMD dpkg-divert --rename --add /usr/sbin/update-grub
77 $ROOTCMD ln -s /bin/true /usr/sbin/update-grub
80 # newer aptitude versions won't remove essential packages using
81 # 'aptitude -f -y install file-rc' anymore, therefore force it:
82 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
84 if ! $ROOTCMD test -x /usr/bin/aptitude ; then
85 $ROOTCMD apt-get -y install aptitude
88 # make sure we can upgrade automatically,
89 # even with unsigned repos, but only if user wants it
90 if [ "${FAI_ALLOW_UNSIGNED:-}" = "1" ] ; then
91 APTGET_OPTS="${APTGET_OPTS:-} --allow-unauthenticated"
92 APTITUDE_OPTS="${APTITUDE_OPTS:-} --allow-untrusted"
95 if $ROOTCMD test -x /usr/bin/aptitude ; then
96 if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
97 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS safe-upgrade
99 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS upgrade
102 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y $APTGET_OPTS --force-yes upgrade
105 exit # make sure we don't continue behind the following "fi"
108 # no softupdate but fresh installation
109 echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
111 # make sure we have file-rc available before package_config/GRML* is being executed {{{
112 # the apt-get update might return an error if there's for example
113 # a hashsum mismatch on Debian mirror sources, we might want to continue
114 # but should warn the user
115 if ! $ROOTCMD apt-get update ; then
116 echo "Warning: there was an error executing apt-get update, continuing anyway."
117 echo "Warning: there was an error executing apt-get update, continuing anyway." >&2
120 # newer aptitude versions won't remove essential packages using
121 # 'aptitude -f -y install file-rc' anymore, therefore force it via:
122 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
125 # get rid of insserv:
126 if $ROOTCMD dpkg --list insserv 2>/dev/null | grep -q '^ii' ; then
127 $ROOTCMD apt-get -y --purge remove insserv
130 # we definitely don't want to fail running fai dirinstall just
131 # because of some well known bugs:
132 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
133 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
134 // Check all packages whether they has critical bugs before they are installed.
135 // If you don't like it, comment it out.
136 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
137 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
138 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
141 # make sure /dev/MAKEDEV is available:
142 if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then
143 ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV
146 # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)):
147 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
148 rm -f "$target"/usr/sbin/invoke-rc.d
149 $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
152 ## END OF FILE #################################################################
153 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2