set -xeuo pipefail
. "$KOLA_EXT_DATA/commonlib.sh"
varsrc=$(findmnt -nvr /var -o SOURCE)
rootsrc=$(findmnt -nvr /sysroot -o SOURCE)
[[ $(realpath "$varsrc") == $(realpath "$rootsrc") ]]
ok "/var is backed by rootfs"
if ! systemctl cat boot.mount | grep -q What=/dev/disk/by-uuid; then
systemctl cat boot.mount
fatal "boot mounted not by UUID"
fi
ok "boot mounted by UUID"
[ -f /boot/.root_uuid ]
if [ "$(arch)" == "ppc64le" ] || [ "$(arch)" == "s390x" ]; then
echo "skipping EFI verification on arch $(arch)"
else
[ -f /boot/grub2/bootuuid.cfg ]
mount -o ro /dev/disk/by-label/EFI-SYSTEM /boot/efi
found_bootuuid="false"
for f in /boot/efi/EFI/*/bootuuid.cfg; do
if [ -f "$f" ]; then
found_bootuuid="true"
fi
done
if [[ "${found_bootuuid}" == "false" ]]; then
fatal "No /boot/efi/EFI/*/bootuuid.cfg found"
fi
umount /boot/efi
fi
case "${AUTOPKGTEST_REBOOT_MARK:-}" in
"")
ok "first boot"
/tmp/autopkgtest-reboot rebooted
;;
rebooted)
grep root=UUID="$(cat /boot/.root_uuid)" /proc/cmdline
ok "found root karg"
bootsrc=$(findmnt -nvr /boot -o SOURCE)
eval $(blkid -p -o export "${bootsrc}")
grep boot=UUID="${UUID}" /proc/cmdline
ok "found boot karg"
ok "second boot"
;;
*) fatal "unexpected mark: ${AUTOPKGTEST_REBOOT_MARK}";;
esac