Copy /etc/resolv.conf in /etc/grml/fai/config/hooks/instsoft.GRMLBASE
[grml-live.git] / etc / grml / fai / config / hooks / instsoft.GRMLBASE
1 #!/bin/sh
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 Nov 04 11:01:20 CET 2007 [mika]
8 ################################################################################
9
10 set -u
11 set -e
12
13 # visualize chroot inside zsh:
14 echo grml_chroot > $target/etc/debian_chroot
15
16 if [ "$FAI_ACTION" = "softupdate" ] ; then
17    echo "Softupdate of FAI via grml-live running"
18
19    if [ -r /etc/resolv.conf ] ; then
20       cat /etc/resolv.conf >> $target/etc/resolv.conf
21    fi
22
23    # make sure we prefer grml repository:
24    if [ -r /etc/grml/fai/apt/preferences ] ; then
25       cp /etc/grml/fai/apt/preferences $target/etc/apt/preferences
26    fi
27
28    if [ -r /etc/grml/fai/apt/sources.list ] ; then
29       if [ -L $target/etc/apt/sources.list ] ; then
30          rm $target/etc/apt/sources.list
31       fi
32       cp /etc/grml/fai/apt/sources.list $target/etc/apt/sources.list
33    fi
34
35    $ROOTCMD apt-get update
36
37 else # no softupdate but fresh installation
38
39 # work around http://trac.lighttpd.net/trac/ticket/657
40 # should be removed later on:
41 echo "Acquire::http::Pipeline-Depth "0"; // added by grml-live" >> $target/etc/apt/apt.conf
42
43 # Recommends just pull in way tooooo much packages, so disable it:
44 echo "APT::Install-Recommends "false"; // added by grml-live"   >> $target/etc/apt/apt.conf
45
46 # install grml keys:
47 gpg --keyserver subkeys.pgp.net      --recv-keys F61E2E7CECDEA787 || \
48 gpg --keyserver blackhole.pca.dfn.de --recv-keys F61E2E7CECDEA787
49 gpg --export F61E2E7CECDEA787 > $target/etc/apt/grml.key
50 $ROOTCMD apt-key add /etc/apt/grml.key
51
52 # make sure we prefer grml repository:
53 if [ -r /etc/grml/fai/files/etc/apt/preferences ] ; then
54    cp /etc/grml/fai/apt/preferences $target/etc/apt/preferences
55 fi
56
57 # make sure we have file-rc available before
58 # package_config/GRML is being executed:
59 $ROOTCMD apt-get update
60 $ROOTCMD aptitude -f -y install file-rc
61
62 # Workaround #443481 of snort for Debian/etch:
63 mkdir -p $target/etc/snort
64 echo 'LOGDIR=/var/log/snort' >> $target/etc/snort/snort.common.parameters
65
66 # we definitely don't want to fail running fai dirinstall just
67 # because of some well known bugs:
68 [ -d $target/etc/apt/apt.conf.d ] || mkdir $target/etc/apt/apt.conf.d
69 cat > $target/etc/apt/apt.conf.d/10apt-listbugs << EOF
70 // Check all packages whether they has critical bugs before they are installed.
71 // If you don't like it, comment it out.
72 //DPkg::Pre-Install-Pkgs {"/usr/sbin/apt-listbugs apt || exit 10"};
73 //DPkg::Tools::Options::/usr/sbin/apt-listbugs "";
74 //DPkg::Tools::Options::/usr/sbin/apt-listbugs::Version "2";
75 EOF
76
77 # make sure /dev/MAKEDEV is available:
78 if [ -x "$target"/sbin/MAKEDEV ] && ! [ -r "$target"/dev/MAKEDEV ] ; then
79    ln -s /sbin/MAKEDEV "$target"/dev/MAKEDEV
80 fi
81
82 # we don't need the invoke-rc.d.d diversion (we have grml-policyrcd :)):
83 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
84    rm -f "$target"/usr/sbin/invoke-rc.d
85    $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
86 fi
87
88 fi # end of FAI_ACTION = softupdate
89
90 ## END OF FILE #################################################################
91 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3