upstream 5.1 sample config
[automated-distro-installer] / fai / config / scripts / LAST / 50-misc
1 #! /bin/bash
2
3 # copyright Thomas Lange 2001-2015, lange@debian.org
4
5 error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
6
7 # check if mdadm has been forgotten
8 if grep -q active /proc/mdstat 2>/dev/null; then
9 if [ ! -d $target/etc/mdadm ]; then
10 echo ERROR: Found Software RAID, but the mdadm package was not installed
11 error=1
12 fi
13 fi
14
15 usedm=$(dmsetup ls | egrep -v '^live-rw|^live-base|^No devices found' | wc -l)
16 if [ $usedm -ne 0 ]; then
17 if [ ! -d $target/etc/lvm ]; then
18 echo ERROR: Found lvm devices, but the lvm2 package was not installed
19 error=1
20 fi
21 fi
22
23 # remove backup files from cfengine, but only if cfengine is installed
24 if [ -x /usr/sbin/cfagent ] || [ -x $target/usr/sbin/cfagent ] ; then
25 dirs="root etc var"
26 for path in $dirs; do
27 find $target/$path -maxdepth 20 -name \*.cfedited -o -name \*.cfsaved | xargs -r rm
28 done
29 fi
30
31 [ "$FAI_DEBMIRROR" ] &&
32 ainsl /etc/fstab "#$FAI_DEBMIRROR $MNTPOINT nfs ro 0 0"
33
34 # set bios clock
35 if [ $do_init_tasks -eq 1 ] ; then
36 case "$UTC" in
37 no|"") hwopt="--localtime" ;;
38 yes) hwopt="--utc" ;;
39 esac
40 hwclock $hwopt --systohc || true
41 fi
42
43 # Make sure everything is configured properly
44 if ifclass DEBIAN ; then
45 echo "Running \"apt-get -f install\" for the last time."
46 $ROOTCMD apt-get -f install
47 fi
48
49 if [ $FAI_ACTION = "install" ]; then
50 lskernels=$(echo $target/boot/vmlinu*)
51 [ -f ${lskernels%% *} ] || echo "ERROR: No kernel was installed. Have a look at shell.log" >&2
52 fi
53
54 # copy sources.list
55 fcopy -iM /etc/apt/sources.list
56
57 exit $error