1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#! /bin/bash
# fai-diskimage
# Depends fai-setup-storage
# apt -o APT::Install-Suggests=0 -o APT::Install-Recommends=0 install fai-setup-storage
. ./debian/tests/common.sh
cd "$AUTOPKGTEST_TMP"
chk-loop-device
vlf=/var/log/fai
main-check() {
chk-size /mnt/boot 38
chk-size /mnt/lib 250
chk-size /mnt/bin 45
chk-size /mnt/usr/lib/modules 100
chk-file /mnt/boot/grub/grub.cfg
chk-file /mnt/etc/network/interfaces.d/eth0
chk-file /mnt/etc/rc.local
echo 'd41d8cd98f00b204e9800998ecf8427e /mnt/etc/machine-id' | md5sum -c
chk-no-file /mnt/var/lib/dbus/machine-id
chk-no-file /mnt/etc/udev/rules.d/70-persistent-net.rules
chk-no-file /mnt/etc/resolv.conf
chk-no-file /mnt/etc/ssh/ssh_host_ed25519_key
chk-no-file /mnt/etc/ssh/ssh_host_ecdsa_key
chk-no-file /mnt/etc/dpkg/dpkg.cfg.d/unsafe-io
}
trap "cp -ap /var/log/fai/cloud? diskimage*.log $AUTOPKGTEST_ARTIFACTS" INT QUIT EXIT
if [ ! -d /srv/fai/config ]; then
fai-mk-configspace
fi
chk-file /srv/fai/config/class/50-host-classes
echo "=== creating and testing legacy bios diskimage ==="
cl="DEBIAN,AMD64,FAIBASE,GRUB_PC,DHCPC,DEMO,CLOUD,LAST"
LC_ALL=C fai-diskimage -vu cloud3 -S2G -c$cl cloud.raw >& diskimage.log
echo fai-diskimage return code $?
# test the results of the commands called
chk-size cloud.raw 750
mount -oloop,ro,offset=1048576 cloud.raw /mnt
main-check
umount /mnt
if grep -q FAILED $vlf/cloud3/last/status.log; then
error "fai-diskimage failed. See status.log"
fi
if [ -f $vlf/cloud3/last/error.log ]; then
cat $vlf/cloud3/last/error.log >/dev/stderr
fi
if [ X$NO_CLEANUP != X1 ]; then
rm cloud.raw
fi
echo "=== creating and testing EFI diskimage ==="
# now create a diskimage using EFI
cl="DEBIAN,AMD64,FAIBASE,GRUB_EFI,DHCPC,DEMO,CLOUD,CLOUD_EFI,LAST"
LC_ALL=C fai-diskimage -vu cloud4 -S2G -c$cl cloud-efi.raw >& diskimage-efi.log
echo fai-diskimage return code $?
chk-size cloud-efi.raw 750
mount -oloop,offset=1048576 cloud-efi.raw /mnt
chk-file /mnt/EFI/debian/grubx64.efi
chk-file /mnt/EFI/BOOT/BOOTX64.EFI
umount /mnt
dev=$(losetup --show -f cloud-efi.raw)
partprobe -s $dev
mount ${dev}p2 /mnt
main-check
umount /mnt
losetup -D $dev
if grep -q FAILED $vlf/cloud4/last/status.log; then
error "fai-diskimage failed. See status.log"
fi
if [ -f $vlf/cloud4/last/error.log ]; then
cat $vlf/cloud4/last/error.log >/dev/stderr
fi
if [ X$NO_CLEANUP != X1 ]; then
rm cloud-efi.raw
fi
|