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 # /etc/resolv.conf is usually a symlink, pointing out of the chroot.
24 # Make it a file with known contents.
25 rm -f "${target}"/etc/resolv.conf
26 cat /etc/resolv.conf >> "$target"/etc/resolv.conf
28 if [ -r $target/etc/policy-rc.d.conf ] ; then
29 sed -i "s/EXITSTATUS=.*/EXITSTATUS='101'/" $target/etc/policy-rc.d.conf
32 # we definitely don't want to fail running fai sofupdate just
33 # because of some well known bugs:
34 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
35 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
36 // Check all packages whether they has critical bugs before they are installed.
37 // If you don't like it, comment it out.
38 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
39 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
40 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
43 # work around /etc/kernel/postinst.d/zz-update-grub failing
44 # inside openvz environment, see #597084
45 if ! $ROOTCMD dpkg-divert --list | grep -q '/usr/sbin/update-grub' ; then
46 echo "Diverting update-grub executable"
47 $ROOTCMD dpkg-divert --rename --add /usr/sbin/update-grub
48 $ROOTCMD ln -s /bin/true /usr/sbin/update-grub
51 # newer aptitude versions won't remove essential packages using
52 # 'aptitude -f -y install file-rc' anymore, therefore force it:
53 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
55 if ! $ROOTCMD test -x /usr/bin/aptitude ; then
56 $ROOTCMD apt-get -y install aptitude
59 # Update package lists (so they exist at all), so we actually can
61 $ROOTCMD apt-get update
63 # make sure we can upgrade automatically,
64 # even with unsigned repos, but only if user wants it
65 if [ "${FAI_ALLOW_UNSIGNED:-}" = "1" ] ; then
66 APTGET_OPTS="${APTGET_OPTS:-} --allow-unauthenticated"
67 APTITUDE_OPTS="${APTITUDE_OPTS:-} --allow-untrusted"
70 if $ROOTCMD test -x /usr/bin/aptitude ; then
71 if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
72 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS safe-upgrade
74 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y $APTITUDE_OPTS upgrade
77 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y $APTGET_OPTS --force-yes upgrade
80 exit # make sure we don't continue behind the following "fi"
83 # no softupdate but fresh installation
84 echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
86 # make sure we have file-rc available before package_config/GRML* is being executed {{{
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."
92 echo "Warning: there was an error executing apt-get update, continuing anyway." >&2
95 # newer aptitude versions won't remove essential packages using
96 # 'aptitude -f -y install file-rc' anymore, therefore force it via:
97 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
100 # get rid of insserv:
101 if $ROOTCMD dpkg --list insserv 2>/dev/null | grep -q '^ii' ; then
102 $ROOTCMD apt-get -y --purge remove insserv
105 # we definitely don't want to fail running fai dirinstall just
106 # because of some well known bugs:
107 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
108 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
109 // Check all packages whether they has critical bugs before they are installed.
110 // If you don't like it, comment it out.
111 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
112 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
113 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
116 # make sure /dev/MAKEDEV is available:
117 if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then
118 ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV
121 # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)):
122 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
123 rm -f "$target"/usr/sbin/invoke-rc.d
124 $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
127 ## END OF FILE #################################################################
128 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2