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 GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list"
13 DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list"
15 # if hooks/updatebase.GRMLBASE fails for whatever reason
16 # and can't skip instsoft.GRMLBASE we have to make sure
17 # we exit here as well
18 if [ -n "$BUILD_ONLY" ] ; then
19 "Exiting hooks/instsoft.GRMLBASE as BUILD_ONLY environment is set."
23 if [ "$FAI_ACTION" = "softupdate" ] ; then
24 echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
26 if [ -r /etc/resolv.conf ] ; then
27 if [ -d $target/etc/resolvconf/run ] ; then # resolvconf without /run
28 # sanity check to avoid "input file is output file",
29 # see http://bts.grml.org/grml/issue984
30 if ! [ -L $target/etc/resolvconf/run/resolv.conf ] ; then
31 cat /etc/resolv.conf >> $target/etc/resolvconf/run/resolv.conf
33 echo "Error: /etc/resolvconf/run/resolv.conf in chroot should not be a symlink." >&2
34 echo " Looks like something is wrong, please fix manually." >&2
37 elif [ -L $target/etc/resolvconf/run ] ; then # resolvconf with /run
38 # /etc/resolvconf/run symlinks to /run/resolvconf
39 mkdir -p $target/run/resolvconf
40 cat /etc/resolv.conf >> $target/run/resolvconf/resolv.conf
41 else # no resolvconf installed in chroot
42 if ! [ -L $target/etc/resolv.conf ] ; then
43 cat /etc/resolv.conf >> $target/etc/resolv.conf
45 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 # FAI softupdate executes upgrade only with the sources.list being
67 # present in the chroot - so let's do it on our own:
68 fcopy /etc/apt/sources.list
70 # when re-running grml-live with the -u option we do not want to use the
71 # sources.list config of the live system but grml-live's config instead,
72 # therefore temporarly move known files and restore them again later on
73 # through /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup:
74 if [ -r "$GRML_SOURCES_LIST" ] ; then
75 mv "$GRML_SOURCES_LIST" "${GRML_SOURCES_LIST}.unused"
78 if [ -r "$DEBIAN_SOURCES_LIST" ] ; then
79 mv "$DEBIAN_SOURCES_LIST" "${DEBIAN_SOURCES_LIST}.unused"
82 # run it on our own, as updatebase is used at the wrong stage for our needs,
83 # see ${GRML_FAI_CONFIG}/hooks/updatebase.GRMLBASE
84 # the apt-get update might return an error if there's for example
85 # a hashsum mismatch on Debian mirror sources, we might want to continue
86 # but should warn the user
87 if ! $ROOTCMD apt-get update ; then
88 echo "Warning: there was an error executing apt-get update, continuing anyway."
91 # newer aptitude versions won't remove essential packages using
92 # 'aptitude -f -y install file-rc' anymore, therefore force it:
93 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
95 if ! [ -x $target/usr/bin/aptitude ] ; then
96 $ROOTCMD apt-get -y install aptitude
99 if [ -x $target/usr/bin/aptitude ] ; then
100 if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
101 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y safe-upgrade
103 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y upgrade
106 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y upgrade
109 exit # make sure we don't continue behind the following "fi"
112 # no softupdate but fresh installation
113 echo "Action $FAI_ACTION of FAI (hooks/instsoft.GRMLBASE) via grml-live running"
115 # make sure we have file-rc available before package_config/GRML* is being executed {{{
116 # the apt-get update might return an error if there's for example
117 # a hashsum mismatch on Debian mirror sources, we might want to continue
118 # but should warn the user
119 if ! $ROOTCMD apt-get update ; then
120 echo "Warning: there was an error executing apt-get update, continuing anyway."
121 echo "Warning: there was an error executing apt-get update, continuing anyway." >&2
124 # newer aptitude versions won't remove essential packages using
125 # 'aptitude -f -y install file-rc' anymore, therefore force it via:
126 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
129 # get rid of insserv:
130 if $ROOTCMD dpkg --list insserv 2>/dev/null | grep -q '^ii' ; then
131 $ROOTCMD apt-get -y --purge remove insserv
134 # we definitely don't want to fail running fai dirinstall just
135 # because of some well known bugs:
136 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
137 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
138 // Check all packages whether they has critical bugs before they are installed.
139 // If you don't like it, comment it out.
140 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
141 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
142 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
145 # make sure /dev/MAKEDEV is available:
146 if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then
147 ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV
150 # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)):
151 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
152 rm -f "$target"/usr/sbin/invoke-rc.d
153 $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
156 ## END OF FILE #################################################################
157 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2