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 # make sure we prefer grml repository:
37 if [ -r /etc/grml/fai/apt/preferences ] ; then
38 cp /etc/grml/fai/apt/preferences $target/etc/apt/preferences
41 # we definitely don't want to fail running fai sofupdate just
42 # because of some well known bugs:
43 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
44 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
45 // Check all packages whether they has critical bugs before they are installed.
46 // If you don't like it, comment it out.
47 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
48 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
49 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
52 # make sure we can handle kernel upgrades:
53 if [ -r $target/etc/kernel-img.conf ] ; then
54 if ! grep -q "silent_modules = Yes" $target/etc/kernel-img.conf ; then
55 echo "silent_modules = Yes" >> $target/etc/kernel-img.conf
59 # FAI softupdate executes upgrade only with the sources.list being
60 # present in the chroot :-/ - so let's do it on our own:
61 if [ -r /etc/grml/fai/apt/sources.list ] ; then
62 if [ -L $target/etc/apt/sources.list ] ; then
63 rm $target/etc/apt/sources.list
65 cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list
68 # run it on our own, as updatebase is used at the wrong stage for our needs,
69 # see /etc/grml/fai/config/hooks/updatebase.GRMLBASE
70 $ROOTCMD apt-get update
71 if ! [ -x $target/usr/bin/aptitude ] ; then
72 $ROOTCMD apt-get -y install aptitude
75 if [ -x $target/usr/bin/aptitude ] ; then
76 if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
77 $ROOTCMD aptitude -y safe-upgrade
79 $ROOTCMD aptitude -y upgrade
82 $ROOTCMD apt-get -y upgrade
85 else # no softupdate but fresh installation
87 # work around http://trac.lighttpd.net/trac/ticket/657
88 # should be removed later on:
89 echo "Acquire::http::Pipeline-Depth "0"; // added by grml-live" >> $target/etc/apt/apt.conf
91 # Recommends just pull in way tooooo much packages, so disable it:
92 echo "APT::Install-Recommends "false"; // added by grml-live" >> $target/etc/apt/apt.conf
93 # Notice: deprecated since aptitude (0.4.11-1):
94 echo "Aptitude::Recommends-Important "false"; // added by grml-live" >> $target/etc/apt/apt.conf
96 # install all present (but at least the grml) gpg keys:
97 if [ -r /etc/grml/fai/files/etc/apt/grml.key ] ; then
98 for file in /etc/grml/fai/files/etc/apt/*.key ; do
99 FILE="$(basename $file)"
100 cp $file $target/etc/apt/"$FILE"
101 $ROOTCMD apt-key add /etc/apt/"$FILE"
104 gpg --keyserver subkeys.pgp.net --recv-keys F61E2E7CECDEA787 || \
105 gpg --keyserver blackhole.pca.dfn.de --recv-keys F61E2E7CECDEA787
106 gpg --export F61E2E7CECDEA787 > $target/etc/apt/grml.key
107 $ROOTCMD apt-key add /etc/apt/grml.key
110 # make sure we prefer grml repository:
111 if [ -r /etc/grml/fai/files/etc/apt/preferences ] ; then
112 cp /etc/grml/fai/apt/preferences $target/etc/apt/preferences
115 # make sure we have file-rc available before
116 # package_config/GRML is being executed:
117 $ROOTCMD apt-get update
118 $ROOTCMD aptitude -f -y install file-rc
120 # Workaround #443481 of snort for Debian/etch:
121 mkdir -p $target/etc/snort
122 echo 'LOGDIR=/var/log/snort' >> $target/etc/snort/snort.common.parameters
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 fi # end of FAI_ACTION = softupdate
148 ## END OF FILE #################################################################
149 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3