diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 13:54:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 13:54:25 +0000 |
commit | 9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a (patch) | |
tree | 2efb72864cc69e174c9c5ee33efb88a5f1553b48 /modules.d/91zipl/module-setup.sh | |
parent | Initial commit. (diff) | |
download | dracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.tar.xz dracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.zip |
Adding upstream version 060+5.upstream/060+5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | modules.d/91zipl/module-setup.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/modules.d/91zipl/module-setup.sh b/modules.d/91zipl/module-setup.sh new file mode 100755 index 0000000..cb21454 --- /dev/null +++ b/modules.d/91zipl/module-setup.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +get_boot_zipl_dev() { + local _boot_zipl + _boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' "$dracutsysrootdir"/etc/fstab) + printf "%s" "$(trim "$_boot_zipl")" +} + +# called by dracut +check() { + local _arch=${DRACUT_ARCH:-$(uname -m)} + # Only for systems on s390 using indirect booting via userland grub + [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 + # /boot/zipl contains a first stage kernel used to launch grub in initrd + [ -d /boot/zipl ] || return 1 + return 0 +} + +# called by dracut +depends() { + return 0 +} + +# called by dracut +installkernel() { + local _boot_zipl + + _boot_zipl=$(get_boot_zipl_dev) + if [ -n "$_boot_zipl" ]; then + eval "$(blkid -s TYPE -o udev "${_boot_zipl}")" + if [ -n "$ID_FS_TYPE" ]; then + case "$ID_FS_TYPE" in + ext?) + ID_FS_TYPE=ext4 + ;; + esac + instmods ${ID_FS_TYPE} + fi + fi +} + +# called by dracut +cmdline() { + local _boot_zipl + + _boot_zipl=$(get_boot_zipl_dev) + if [ -n "$_boot_zipl" ]; then + printf "%s" " rd.zipl=${_boot_zipl}" + fi +} + +# called by dracut +install() { + inst_multiple mount umount + + inst_hook cmdline 91 "$moddir/parse-zipl.sh" + inst_script "${moddir}/install_zipl_cmdline.sh" /sbin/install_zipl_cmdline.sh + if [[ $hostonly_cmdline == "yes" ]]; then + local _zipl + _zipl=$(cmdline) + + [[ $_zipl ]] && printf "%s\n" "$_zipl" > "${initdir}/etc/cmdline.d/91zipl.conf" + fi + dracut_need_initqueue +} |