Files
s390-tools/zdev/dracut/95zdev/parse-zfcp.sh
Steffen Maier 06a30ae529 zdev/dracut: add rd.zfcp cmdline option handling
Add parsing of dracut cmdline option "rd.zfcp=..." at initrd runtime.
It delegates configuration to chzdev.

Implement `dracut --print-cmdline` and `dracut --hostonly-cmdline` for
initrd build time. Emit an rd.zfcp option for each zfcp-attached SCSI disk
in dracut's device dependency graph (to mount the root-fs, or to access the
kdump target).

This allows a distribution independent device configuration.
Configuration is consistent by using chzdev as backend.
It also prevents duplicate activations of the same device.

Along with the existing functionality of zdev/dracut, it makes the
following dracut modules superfluous:
https://github.com/dracutdevs/dracut/tree/master/modules.d/95zfcp
[rd.zfcp.conf is no longer needed and thus ignored here; the preceding
 ("zdev/dracut: fix marking hostonly files so delete option works")
 makes rd.hostonly=0 work as a generic replacement]
https://github.com/dracutdevs/dracut/tree/master/modules.d/95zfcp_rules

Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/158
Acked-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-12-14 15:25:22 +01:00

36 lines
1.0 KiB
Bash

#!/bin/sh
#
# Copyright IBM Corp. 2023
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
#
# 95zdev/parse-zfcp.sh
# Parse the command line for rd.zfcp parameters. These
# parameters are evaluated and used to configure zfcp devices.
#
zdev_zfcp_base_args="--no-settle --yes --quiet --no-root-update --force"
for zdev_zfcp_arg in $(getargs rd.zfcp -d 'rd_ZFCP='); do
(
IFS_SAVED="$IFS"
IFS="," # did not work in front of built-in set command below
# shellcheck disable=SC2086
set -- $zdev_zfcp_arg
IFS=":" args="$*"
IFS="$IFS_SAVED"
if [ "$#" -eq 1 ]; then
# shellcheck disable=SC2086
chzdev --enable --persistent $zdev_zfcp_base_args \
zfcp-host "$args"
else
# shellcheck disable=SC2086
chzdev --enable --persistent $zdev_zfcp_base_args \
zfcp-lun "$args"
fi
)
done
unset zdev_zfcp_arg
unset zdev_zfcp_base_args