2 # Filename: /etc/grml/fai/config/hooks/instsoft.GRML
3 # Purpose: grml specific Debian installation in the chroot
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 # visualize chroot inside zsh:
13 echo grml_chroot > $target/etc/debian_chroot
16 [ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
17 [ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
18 [ -n "$HOSTNAME" ] || HOSTNAME=grml
19 echo "$HOSTNAME" > $target/etc/hostname
21 if [ "$FAI_ACTION" = "softupdate" ] ; then
22 echo "Softupdate of FAI via grml-live running"
24 if [ -r /etc/resolv.conf ] ; then
25 if [ -r $target/etc/resolvconf/run/resolv.conf ] ; then
26 cat /etc/resolv.conf >> $target/etc/resolvconf/run/resolv.conf
28 cat /etc/resolv.conf >> $target/etc/resolv.conf
32 if [ -r $target/etc/policy-rc.d.conf ] ; then
33 sed -i "s/EXITSTATUS=.*/EXITSTATUS='101'/" $target/etc/policy-rc.d.conf
36 # we definitely don't want to fail running fai sofupdate just
37 # because of some well known bugs:
38 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
39 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
40 // Check all packages whether they has critical bugs before they are installed.
41 // If you don't like it, comment it out.
42 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
43 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
44 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
47 # make sure we can handle kernel upgrades:
48 if [ -r $target/etc/kernel-img.conf ] ; then
49 if ! grep -q "silent_modules = Yes" $target/etc/kernel-img.conf ; then
50 echo "silent_modules = Yes" >> $target/etc/kernel-img.conf
54 # FAI softupdate executes upgrade only with the sources.list being
55 # present in the chroot - so let's do it on our own:
56 if [ -r /etc/grml/fai/apt/sources.list ] ; then
57 if [ -L $target/etc/apt/sources.list ] ; then
58 rm $target/etc/apt/sources.list
61 # install grml-live's (on the fly adjusted) sources.list config
62 cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list.d/grml-live.list
64 # when re-running grml-live with the -u option we do not want to use the
65 # sources.list config of the live system but grml-live's config instead,
66 # therefore temporarly move known files and restore them again later on
67 # through /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup:
68 if [ -r $target/etc/apt/sources.list.d/grml.list ] ; then
69 mv $target/etc/apt/sources.list.d/grml.list $target/etc/apt/sources.list.d/grml.unused
71 if [ -r $target/etc/apt/sources.list.d/debian.list ] ; then
72 mv $target/etc/apt/sources.list.d/debian.list $target/etc/apt/sources.list.d/debian.unused
76 # run it on our own, as updatebase is used at the wrong stage for our needs,
77 # see /etc/grml/fai/config/hooks/updatebase.GRMLBASE
78 # the apt-get update might return an error if there's for example
79 # a hashsum mismatch on Debian mirror sources, we might want to continue
80 # but should warn the user
81 if ! $ROOTCMD apt-get update ; then
82 echo "Warning: there was an error executing apt-get update, continuing anyway."
85 # newer aptitude versions won't remove essential packages using
86 # 'aptitude -f -y install file-rc' anymore, therefore force it:
87 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
89 if ! [ -x $target/usr/bin/aptitude ] ; then
90 $ROOTCMD apt-get -y install aptitude
93 if [ -x $target/usr/bin/aptitude ] ; then
94 if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
95 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y safe-upgrade
97 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD aptitude -y upgrade
100 APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none $ROOTCMD apt-get -y upgrade
103 else # no softupdate but fresh installation
105 # install all apt related files
108 # remove grml-live's sources.list file from chroot:
109 if [ -r $target/etc/apt/important_note.txt ] ; then
110 grep -q GRML_LIVE_SOURCES $target/etc/apt/important_note.txt && rm $target/etc/apt/important_note.txt
113 # install grml gpg key:
114 fcopy /etc/apt/grml.key
115 $ROOTCMD apt-key add /etc/apt/grml.key
116 # gpg --keyserver subkeys.pgp.net --recv-keys F61E2E7CECDEA787 || \
117 # gpg --keyserver blackhole.pca.dfn.de --recv-keys F61E2E7CECDEA787
118 # gpg --export F61E2E7CECDEA787 > $target/etc/apt/grml.key
119 # $ROOTCMD apt-key add /etc/apt/grml.key
121 # make sure the file exists
122 [ -e $target/etc/apt/apt.conf ] || touch $target/etc/apt/apt.conf
124 # work around http://trac.lighttpd.net/trac/ticket/657
125 if ! grep -q 'Acquire::http::Pipeline-Depth.*0' $target/etc/apt/apt.conf ; then
126 echo "Acquire::http::Pipeline-Depth 0; // added by grml-live" >> $target/etc/apt/apt.conf
129 # Recommends just pull in way tooooo much packages, so disable it:
130 if ! grep -q 'APT::Install-Recommends.*false' $target/etc/apt/apt.conf ; then
131 echo "APT::Install-Recommends false; // added by grml-live" >> $target/etc/apt/apt.conf
134 # Notice: deprecated with aptitude (0.4.11-1):
135 if ! grep -q 'Aptitude::Recommends-Important.*false' $target/etc/apt/apt.conf ; then
136 echo "Aptitude::Recommends-Important false; // added by grml-live" >> $target/etc/apt/apt.conf
139 # make sure we have file-rc available before package_config/GRML is
141 # the apt-get update might return an error if there's for example
142 # a hashsum mismatch on Debian mirror sources, we might want to continue
143 # but should warn the user
144 if ! $ROOTCMD apt-get update ; then
145 echo "Warning: there was an error executing apt-get update, continuing anyway."
147 # newer aptitude versions won't remove essential packages using
148 # 'aptitude -f -y install file-rc' anymore, therefore force it:
149 $ROOTCMD aptitude -o Aptitude::ProblemResolver::Keep-All-Tier=60000 -f -y install file-rc
152 # get rid of insserv:
153 if $ROOTCMD dpkg --list insserv 2>/dev/null | grep -q '^ii' ; then
154 $ROOTCMD apt-get -y --purge remove insserv
157 # we definitely don't want to fail running fai dirinstall just
158 # because of some well known bugs:
159 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
160 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
161 // Check all packages whether they has critical bugs before they are installed.
162 // If you don't like it, comment it out.
163 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
164 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
165 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
168 # make sure /dev/MAKEDEV is available:
169 if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then
170 ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV
173 # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)):
174 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
175 rm -f "$target"/usr/sbin/invoke-rc.d
176 $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
179 fi # end of FAI_ACTION = softupdate
181 ## END OF FILE #################################################################
182 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3