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 # Latest change: Sun Dec 16 18:31:59 CET 2007 [mika]
8 ################################################################################
13 # visualize chroot inside zsh:
14 echo grml_chroot > $target/etc/debian_chroot
17 [ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
18 [ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
19 [ -n "$HOSTNAME" ] || HOSTNAME=grml
20 echo "$HOSTNAME" > $target/etc/hostname
22 if [ "$FAI_ACTION" = "softupdate" ] ; then
23 echo "Softupdate of FAI via grml-live running"
25 if [ -r /etc/resolv.conf ] ; then
26 if [ -r $target/etc/resolvconf/run/resolv.conf ] ; then
27 cat /etc/resolv.conf >> $target/etc/resolvconf/run/resolv.conf
29 cat /etc/resolv.conf >> $target/etc/resolv.conf
33 if [ -r $target/etc/policy-rc.d.conf ] ; then
34 sed -i "s/EXITSTATUS=.*/EXITSTATUS='101'/" $target/etc/policy-rc.d.conf
37 # make sure we prefer grml repository:
38 if [ -r /etc/grml/fai/apt/preferences ] ; then
39 cp /etc/grml/fai/apt/preferences $target/etc/apt/preferences
42 # we definitely don't want to fail running fai sofupdate just
43 # because of some well known bugs:
44 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
45 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
46 // Check all packages whether they has critical bugs before they are installed.
47 // If you don't like it, comment it out.
48 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
49 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
50 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
53 # make sure we can handle kernel upgrades:
54 if [ -r $target/etc/kernel-img.conf ] ; then
55 if ! grep -q "silent_modules = Yes" $target/etc/kernel-img.conf ; then
56 echo "silent_modules = Yes" >> $target/etc/kernel-img.conf
60 # FAI softupdate executes upgrade only with the sources.list being
61 # present in the chroot :-/ - so let's do it on our own:
62 if [ -r /etc/grml/fai/apt/sources.list ] ; then
63 if [ -L $target/etc/apt/sources.list ] ; then
64 rm $target/etc/apt/sources.list
66 cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list
69 # run it on our own, as updatebase is used at the wrong stage for our needs,
70 # see /etc/grml/fai/config/hooks/updatebase.GRMLBASE
71 $ROOTCMD apt-get update
72 if ! [ -x $target/usr/bin/aptitude ] ; then
73 $ROOTCMD apt-get -y install aptitude
76 if [ -x $target/usr/bin/aptitude ] ; then
77 if $ROOTCMD aptitude --help | grep -q safe-upgrade ; then
78 $ROOTCMD aptitude -y safe-upgrade
80 $ROOTCMD aptitude -y upgrade
83 $ROOTCMD apt-get -y upgrade
86 else # no softupdate but fresh installation
88 # work around http://trac.lighttpd.net/trac/ticket/657
89 # should be removed later on:
90 echo "Acquire::http::Pipeline-Depth "0"; // added by grml-live" >> $target/etc/apt/apt.conf
92 # Recommends just pull in way tooooo much packages, so disable it:
93 echo "APT::Install-Recommends "false"; // added by grml-live" >> $target/etc/apt/apt.conf
94 echo "Aptitude::Recommends-Important "false"; // added by grml-live" >> $target/etc/apt/apt.conf
97 gpg --keyserver subkeys.pgp.net --recv-keys F61E2E7CECDEA787 || \
98 gpg --keyserver blackhole.pca.dfn.de --recv-keys F61E2E7CECDEA787
99 gpg --export F61E2E7CECDEA787 > $target/etc/apt/grml.key
100 $ROOTCMD apt-key add /etc/apt/grml.key
102 # make sure we prefer grml repository:
103 if [ -r /etc/grml/fai/files/etc/apt/preferences ] ; then
104 cp /etc/grml/fai/apt/preferences $target/etc/apt/preferences
107 # make sure we have file-rc available before
108 # package_config/GRML is being executed:
109 $ROOTCMD apt-get update
110 $ROOTCMD aptitude -f -y install file-rc
112 # Workaround #443481 of snort for Debian/etch:
113 mkdir -p $target/etc/snort
114 echo 'LOGDIR=/var/log/snort' >> $target/etc/snort/snort.common.parameters
116 # we definitely don't want to fail running fai dirinstall just
117 # because of some well known bugs:
118 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
119 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
120 // Check all packages whether they has critical bugs before they are installed.
121 // If you don't like it, comment it out.
122 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
123 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
124 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
127 # make sure /dev/MAKEDEV is available:
128 if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then
129 ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV
132 # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)):
133 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
134 rm -f "$target"/usr/sbin/invoke-rc.d
135 $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
138 fi # end of FAI_ACTION = softupdate
140 ## END OF FILE #################################################################
141 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3