3 # copyright Thomas Lange 2001-2016, lange@debian.org
5 error
=0; trap 'error=$(($?>$error?$?:$error))' ERR
# save maximum error code
7 if [ "$FAI_ACTION" = "dirinstall" -o $do_init_tasks -eq 0 ] ; then
10 # check if mdadm has been forgotten
11 if grep -q active
/proc
/mdstat
2>/dev
/null
; then
12 if [ ! -d $target/etc
/mdadm
]; then
13 echo ERROR
: Found Software RAID
, but the mdadm package was not installed
18 # i use dm for crypt, not lvm, so this gives false positive. todo, send patch to remove this
20 # usedm=$(dmsetup ls 2>/dev/null | egrep -v '^live-rw|^live-base|^No devices found' | wc -l)
21 # if [ $usedm -ne 0 ]; then
22 # if [ ! -d $target/etc/lvm ]; then
23 # echo ERROR: Found lvm devices, but the lvm2 package was not installed
29 # remove backup files from cfengine, but only if cfengine is installed
30 if [ -x /usr
/sbin
/cfagent
] ||
[ -x $target/usr
/sbin
/cfagent
] ; then
33 find $target/$path -maxdepth 20 -name \
*.cfedited
-o -name \
*.cfsaved |
xargs -r rm
37 [ "$FAI_DEBMIRROR" ] &&
38 ainsl
/etc
/fstab
"#$FAI_DEBMIRROR $MNTPOINT nfs ro 0 0"
41 if [ $do_init_tasks -eq 1 ] ; then
43 no|
"") hwopt
="--localtime" ;;
46 hwclock $hwopt --systohc || true
49 # Make sure everything is configured properly
50 if ifclass DEBIAN || ifclass UBUNTU
; then
51 $ROOTCMD apt-get
-f install -y
54 if [ $FAI_ACTION = "install" ]; then
55 lskernels
=$
(echo $target/boot
/vmlinu
*)
56 if [ ! -f ${lskernels%% *} ]; then
57 echo "ERROR: No kernel was installed. Have a look at shell.log" >&2
63 fcopy
-iSM /etc
/apt
/sources.list
68 # if release is not set, try to determine it
70 if [ -n "$release" ]; then
73 if [ ! -f $target/etc
/os-release
]; then
77 dists
="jessie stretch buster bullseye bookworm trixie jammy focal bionic xenial trusty aramo nabia etiona"
79 if grep -iq $d $target/etc
/os-release
; then
86 # if installation was done from CD, replace useless sources.list
88 if [ -f $target/etc
/apt
/sources.list
-a -n "$release" ]; then
89 grep -q 'file generated by fai-cd' $target/etc
/apt
/sources.list
&& cat <<EOF > $target/etc/apt/sources.list
90 deb $apt_cdn/debian $release main contrib non-free
91 deb $security_cdn/debian-security ${secsuite} main contrib non-free
92 #deb [trusted=yes] http://fai-project.org/download $release koeln
94 # if the package fai-server was installed, enable the project's repository
95 if dpkg-query
--admindir=$target/var
/lib
/dpkg
-W fai-server
>/dev
/null
2>&1; then
96 sed -i -e '/fai-project.org/s/^#//' $target/etc
/apt
/sources.list
100 # for ARM architecture, we may need the kernel and initrd to boot or flash the device
101 if ifclass ARM64
; then
102 cp -pv $target/boot
/vmlinuz
* $target/boot
/initrd
* $FAI_RUNDIR