hooks/updatebase.GRMLBASE: make sure /proc, /sys and /dev are available on update
[grml-live.git] / etc / grml / fai / config / hooks / updatebase.GRMLBASE
1 #!/bin/bash
2 # Filename:      /etc/grml/fai/config/hooks/updatebase.GRMLBASE
3 # Purpose:       skip task updatebase of FAI when running softupdate
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 ################################################################################
8
9 if [ "$FAI_ACTION" = "softupdate" ] ; then
10
11    ## we want to use our own sources.list:
12    skiptask updatebase
13
14    ## taken from FAI's lib/updatebase:
15    # some packages must access /proc even in chroot environment
16    mount -t proc proc $FAI_ROOT/proc
17    # some packages must access /sys even in chroot environment
18    mount -t sysfs sysfs $FAI_ROOT/sys
19    # if we are using udev, also mount it into $FAI_ROOT
20    [ -f /etc/init.d/udev ] && mount --bind /dev $FAI_ROOT/dev
21    mount -t devpts devpts $FAI_ROOT/dev/pts
22
23    ## make sure we don't start any daemons - removed
24    ## later on via /etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot
25    if ! [ -r $target/usr/sbin/policy-rc.d ] ; then
26       cat > $target/usr/sbin/policy-rc.d << EOF
27 #!/bin/sh
28 # FAI_ACTION=updatebase
29 exit 101
30 EOF
31       chmod 755 $target/usr/sbin/policy-rc.d
32    fi
33
34    # skip the task if we want to build a new ISO only:
35    [ -n "$BUILD_ONLY" ] && skiptask instsoft || /bin/true
36
37 else # no softupdate but updating chroot based on /etc/grml/fai/config/basefiles/*
38
39 # install all apt related files
40 fcopy -r /etc/apt
41
42 # remove grml-live's notice file from chroot:
43 if [ -r $target/etc/apt/important_note.txt ] ; then
44    grep -q GRML_LIVE_SOURCES $target/etc/apt/important_note.txt && rm $target/etc/apt/important_note.txt
45 fi
46
47 # install grml gpg key:
48 fcopy /etc/apt/grml.key
49 $ROOTCMD apt-key add /etc/apt/grml.key
50
51 fi # softupdate check
52
53 ## END OF FILE #################################################################
54 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3