Integrate feedback from Thomas Lange (thanks for the review!)
[grml-live.git] / etc / grml / fai / config / hooks / instsoft.GRML
1 #!/bin/sh
2 set -u
3 set -e
4
5 # make sure we have file-rc available before
6 # package_config/GRML is being executed:
7
8 # TODO: test whether adding file-rc to FAI_DEBOOTSTRAP_OPTS= would do the trick too
9
10 # work around http://trac.lighttpd.net/trac/ticket/657:
11 echo "Acquire::http::Pipeline-Depth "0";" >> $target/etc/apt/apt.conf
12
13 # install grml keys:
14 gpg --keyserver subkeys.pgp.net --recv-keys F61E2E7CECDEA787
15 gpg --export F61E2E7CECDEA787 > $target/etc/apt/grml.key
16 $ROOTCMD apt-key add /etc/apt/grml.key
17
18 # finally install file-rc:
19 $ROOTCMD apt-get update
20 $ROOTCMD apt-get --download-only --assume-yes install file-rc
21 $ROOTCMD /bin/sh -c "dpkg -i --force-all /var/cache/apt/archives/file-rc*.deb"
22 $ROOTCMD apt-get -f install file-rc
23
24 # we don't need the invoke-rc.d and update-rc.d diversion
25 # because otherwise use of file-rc with aptitude fails:
26 if [ -L "$target"/usr/sbin/invoke-rc.d ] ; then
27    rm -f "$target"/usr/sbin/invoke-rc.d
28    $ROOTCMD dpkg-divert --package fai --rename --remove /usr/sbin/invoke-rc.d
29 fi
30 if [ -L "$target"/usr/sbin/update-rc.d ] ; then
31    dpkg --purge sysv-rc
32    $ROOTCMD apt-get --assume-yes --reinstall install file-rc
33 fi
34
35 # debug:
36 # $ROOTCMD /bin/bash
37
38 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3