updatebase.GRMLBASE: do no longer skiptask updatebase and exit in softupdate action
[grml-live.git] / etc / grml / fai / config / hooks / updatebase.GRMLBASE
1 #!/bin/bash
2 # Filename:      ${GRML_FAI_CONFIG}/hooks/updatebase.GRMLBASE
3 # Purpose:       Updates the base packages of the system, prepare chroot for instsoft
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 set -u
10 set -e
11
12 # visualize chroot inside zsh:
13 echo grml_chroot > $target/etc/debian_chroot
14
15 HOSTNAME=''
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
20
21 if [ -n "${APT_PROXY:-}" ] ; then
22   cat > $target/etc/apt/apt.conf.d/90grml-apt-proxy.conf <<EOF
23 Acquire::http { Proxy "$APT_PROXY"; };
24 EOF
25 fi
26
27 if [ "$FAI_ACTION" = "softupdate" ] ; then
28    echo "Action $FAI_ACTION of FAI (hooks/updatebase.GRMLBASE) via grml-live running"
29
30    ## based on FAI's lib/updatebase:
31    # some packages must access /proc even in chroot environment
32    if ! [ -d $FAI_ROOT/proc/1 ] ; then
33       mount -t proc proc $FAI_ROOT/proc || true
34    fi
35    # some packages must access /sys even in chroot environment
36    if ! [ -d $FAI_ROOT/sys/kernel ] ; then
37       mount -t sysfs sysfs $FAI_ROOT/sys
38    fi
39    # if we are using udev, also mount it into $FAI_ROOT
40    if [ -f /etc/init.d/udev ] ; then
41       mount --bind /dev $FAI_ROOT/dev || true
42    fi
43
44    mount -t devpts devpts $FAI_ROOT/dev/pts || true
45
46    # skip the task if we want to build a new ISO only,
47    # this means we do NOT update any packages
48    if [ -n "$BUILD_ONLY" ] ; then
49       skiptask instsoft || true
50    fi
51 fi
52
53 if [ -n "$BOOTSTRAP_ONLY" ] ; then
54   echo "Skipping task configure in hooks/updatebase.GRMLBASE as BOOTSTRAP_ONLY environment is set."
55   skiptask configure
56 fi
57
58 # work around #632624: udev fails to install on systems with old kernel versions
59 if ! [ -e ${target}/etc/udev/kernel-upgrade ] ; then
60   echo "Working around udev package bug, creating /etc/udev/kernel-upgrade"
61   echo "# installed via updatebase.GRMLBASE" > ${target}/etc/udev/kernel-upgrade
62 fi
63
64 # install all apt related files
65 fcopy -B -v -r /etc/apt
66
67 # install Grml gpg key:
68 $ROOTCMD apt-key add /etc/apt/grml.key
69
70 ## END OF FILE #################################################################
71 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2