Debian Codegraph @

lib/updatebase

raw
1 #! /bin/bash
2
3 # this script is called after the base.tgz is extract
4 # update packages (from base.tgz) to their newest version
5 # is almost Debian specific
6
7 echo "Updating base"
8
9 # first setup the environment in /target
10 if [ "$FAI_ACTION" = "install" -o "$FAI_ACTION" = "dirinstall" ]; then
11 ctam
12 if [ -f /etc/init.d/udev ]; then
13 mkdir -p $target/run/udev
14 mount --bind /run/udev $target/run/udev
15 fi
16
17 fai-divert -a /usr/sbin/policy-rc.d
18 # never start any daemons inside chroot during installtion
19 cat > $FAI_ROOT/usr/sbin/policy-rc.d <<EOF
20 #!/bin/sh
21 exit 101
22 EOF
23 chmod a+rx $FAI_ROOT/usr/sbin/policy-rc.d
24 fi
25
26 export aptopt="-y -o Dpkg::Options::=--force-confnew"
27 $ROOTCMD apt-get $aptopt update
28 $ROOTCMD apt-get $aptopt check
29 [ $? -ne 0 ] && $ROOTCMD apt-get $aptopt -f install </dev/null
30 $ROOTCMD dpkg -C
31 [ $? -ne 0 ] && yes '' | $ROOTCMD dpkg --configure -a
32 $ROOTCMD apt-get $aptopt dist-upgrade < /dev/null
33 $ROOTCMD apt-get clean