diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh index 821c26a237..dcb5c0693a 100755 --- a/modules.d/01fips/fips.sh +++ b/modules.d/01fips/fips.sh @@ -124,6 +124,21 @@ do_fips() { else BOOT_IMAGE="$(getarg BOOT_IMAGE)" + # On s390x, BOOT_IMAGE isn't a path but an integer representing the + # entry number selected. Let's try the root of /boot first, and + # otherwise fallback to trying to parse the BLS entries if it's a + # BLS-based system. + if [ "$(uname -m)" = s390x ]; then + if [ -e "/boot/vmlinuz-${KERNEL}" ]; then + BOOT_IMAGE="vmlinuz-${KERNEL}" + elif [ -d /boot/loader/entries ]; then + bls=$(find /boot/loader/entries -name '*.conf' | sort -rV | sed -n "$((BOOT_IMAGE + 1))p") + if [ -e "${bls}" ]; then + BOOT_IMAGE=$(grep ^linux "${bls}" | cut -d' ' -f2) + fi + fi + fi + # Trim off any leading GRUB boot device (e.g. ($root) ) BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')" diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh index a1e499af9f..37334b8108 100755 --- a/modules.d/01fips/module-setup.sh +++ b/modules.d/01fips/module-setup.sh @@ -67,7 +67,7 @@ install() { inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh" inst_script "$moddir/fips.sh" /sbin/fips.sh - inst_multiple sha512hmac rmmod insmod mount uname umount + inst_multiple sha512hmac rmmod insmod mount uname umount grep sed cut find sort inst_simple /etc/system-fips [ -c "${initdir}"/dev/random ] || mknod "${initdir}"/dev/random c 1 8 \