-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/kola: move LUKS checks to shared file
Prep for adding another LUKS where we want the same checks.
- Loading branch information
Showing
2 changed files
with
49 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
. $KOLA_EXT_DATA/commonlib.sh | ||
|
||
srcdev=$(findmnt -nvr / -o SOURCE) | ||
[[ ${srcdev} == /dev/mapper/myluksdev ]] | ||
|
||
blktype=$(lsblk -o TYPE "${srcdev}" --noheadings) | ||
[[ ${blktype} == crypt ]] | ||
|
||
fstype=$(findmnt -nvr / -o FSTYPE) | ||
[[ ${fstype} == xfs ]] | ||
ok "source is XFS on LUKS device" | ||
|
||
rootflags=$(findmnt /sysroot -no OPTIONS) | ||
if ! grep prjquota <<< "${rootflags}"; then | ||
fatal "missing prjquota in root mount flags: ${rootflags}" | ||
fi | ||
ok "root mounted with prjquota" | ||
|
||
# while we're here, sanity-check that boot is mounted by UUID | ||
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" | ||
|
||
case "${AUTOPKGTEST_REBOOT_MARK:-}" in | ||
"") | ||
# check that ignition-ostree-growfs ran | ||
if [ ! -e /run/ignition-ostree-growfs.stamp ]; then | ||
fatal "ignition-ostree-growfs did not run" | ||
fi | ||
|
||
# reboot once to sanity-check we can find root on second boot | ||
/tmp/autopkgtest-reboot rebooted | ||
;; | ||
|
||
rebooted) | ||
grep root=UUID= /proc/cmdline | ||
grep rd.luks.name= /proc/cmdline | ||
ok "found root kargs" | ||
|
||
# while we're here, sanity-check that we have a boot=UUID karg too | ||
grep boot=UUID= /proc/cmdline | ||
ok "found boot karg" | ||
;; | ||
*) fatal "unexpected mark: ${AUTOPKGTEST_REBOOT_MARK}";; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters