diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:37 +0000 |
commit | 734d725d62d2cbe4445524448de024e3b9e7f4b3 (patch) | |
tree | 88d8385f24a0efda248b3480fe39037b85e76552 /modules.d/95znet | |
parent | Releasing progress-linux version 060+5-8~progress7.99u1. (diff) | |
download | dracut-734d725d62d2cbe4445524448de024e3b9e7f4b3.tar.xz dracut-734d725d62d2cbe4445524448de024e3b9e7f4b3.zip |
Merging upstream version 102.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/95znet')
-rwxr-xr-x | modules.d/95znet/module-setup.sh | 37 | ||||
-rwxr-xr-x | modules.d/95znet/parse-ccw.sh | 61 |
2 files changed, 86 insertions, 12 deletions
diff --git a/modules.d/95znet/module-setup.sh b/modules.d/95znet/module-setup.sh index df37c66..95164bb 100755 --- a/modules.d/95znet/module-setup.sh +++ b/modules.d/95znet/module-setup.sh @@ -5,7 +5,7 @@ check() { arch=${DRACUT_ARCH:-$(uname -m)} [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 - require_binaries znet_cio_free grep sed seq readlink || return 1 + require_binaries grep sed seq readlink chzdev || return 1 return 0 } @@ -24,6 +24,37 @@ installkernel() { # called by dracut install() { inst_hook cmdline 30 "$moddir/parse-ccw.sh" - inst_rules 81-ccw.rules - inst_multiple znet_cio_free grep sed seq readlink /lib/udev/ccw_init + inst_multiple grep sed seq readlink chzdev + if [[ $hostonly ]]; then + local _tempfile + _tempfile=$(mktemp --tmpdir="${DRACUT_TMPDIR}" dracut-zdev.XXXXXX) + { + chzdev qeth --export - --configured --persistent --quiet --type + chzdev lcs --export - --configured --persistent --quiet --type + chzdev ctc --export - --configured --persistent --quiet --type + } 2> /dev/null > "$_tempfile" + ddebug < "$_tempfile" + chzdev --import "$_tempfile" --persistent --base "/etc=$initdir/etc" \ + --yes --no-root-update --force 2>&1 | ddebug + lszdev --configured --persistent --info \ + --base "/etc=$initdir/etc" 2>&1 | ddebug + rm -f "$_tempfile" + # these are purely generated udev rules so we have to glob expand + # within $initdir and strip the $initdir prefix for mark_hostonly + local -a _array + # shellcheck disable=SC2155 + local _nullglob=$(shopt -p nullglob) + shopt -u nullglob + # shellcheck disable=SC2086 + readarray -t _array < <( + ls -1 $initdir/etc/udev/rules.d/41-*.rules 2> /dev/null + ) + [[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}" + # shellcheck disable=SC2086 + readarray -t _array < <( + ls -1 $initdir/etc/modprobe.d/s390x-*.conf 2> /dev/null + ) + [[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}" + $_nullglob + fi } diff --git a/modules.d/95znet/parse-ccw.sh b/modules.d/95znet/parse-ccw.sh index d895360..ccf05bc 100755 --- a/modules.d/95znet/parse-ccw.sh +++ b/modules.d/95znet/parse-ccw.sh @@ -1,7 +1,50 @@ #!/bin/bash +znet_base_args="--no-settle --yes --no-root-update --force" + +# at this point in time dracut's vinfo() only logs to journal which is hard for +# s390 users to find and access on a line mode console such as 3215 mode +# so use a vinfo alternative that still prints to the console via kmsg +znet_vinfo() { + while read -r _znet_vinfo_line || [ -n "$_znet_vinfo_line" ]; do + # Prefix "<30>" represents facility LOG_DAEMON 3 and loglevel INFO 6: + # (facility << 3) | level. + echo "<30>dracut: $_znet_vinfo_line" > /dev/kmsg + done +} + for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET='); do - echo "$ccw_arg" >> /etc/ccw.conf + ( + SAVED_IFS="$IFS" + IFS="," + # shellcheck disable=SC2086 + set -- $ccw_arg + IFS="$SAVED_IFS" + type="$1" + subchannel1="$2" + subchannel2="$3" + subchannel3="$4" + echo "rd.znet ${ccw_arg} :" | znet_vinfo + if [ "$#" -lt 3 ]; then + echo "rd.znet needs at least 3 list items: type,subchannel1,subchannel2" | znet_vinfo + fi + if [ "$1" = "qeth" ]; then + if [ "$#" -lt 4 ]; then + echo "rd.znet for type qeth needs at least 4 list items: qeth,subchannel1,subchannel2,subchannel3" | znet_vinfo + fi + subchannels="$subchannel1:$subchannel2:$subchannel3" + shift 4 + # shellcheck disable=SC2086 + chzdev --enable --persistent $znet_base_args \ + "$type" "$subchannels" "$@" 2>&1 | znet_vinfo + else + subchannels="$subchannel1:$subchannel2" + shift 3 + # shellcheck disable=SC2086 + chzdev --enable --persistent $znet_base_args \ + "$type" "$subchannels" "$@" 2>&1 | znet_vinfo + fi + ) done for ifname in $(getargs rd.znet_ifname); do @@ -10,16 +53,16 @@ for ifname in $(getargs rd.znet_ifname); do warn "Invalid arguments for rd.znet_ifname=" else { - ifname_subchannels=${ifname_subchannels//,/|} + ifname_subchannels="${ifname_subchannels//,/|}" + # sanitize for use in udev label: replace non-word characters by _ + ifname_if_label="${ifname_if//[^[:word:]]/_}" - echo 'ACTION!="add|change", GOTO="ccw_ifname_end"' - echo 'ATTR{type}!="1", GOTO="ccw_ifname_end"' - echo 'SUBSYSTEM!="net", GOTO="ccw_ifname_end"' + echo "ACTION!=\"add|change\", GOTO=\"ccw_ifname_${ifname_if_label}_end\"" + echo "ATTR{type}!=\"1\", GOTO=\"ccw_ifname_${ifname_if_label}_end\"" + echo "SUBSYSTEM!=\"net\", GOTO=\"ccw_ifname_${ifname_if_label}_end\"" echo "SUBSYSTEMS==\"ccwgroup\", KERNELS==\"$ifname_subchannels\", DRIVERS==\"?*\" NAME=\"$ifname_if\"" - echo 'LABEL="ccw_ifname_end"' + echo "LABEL=\"ccw_ifname_${ifname_if_label}_end\"" - } > /etc/udev/rules.d/81-ccw-ifname.rules + } >> /etc/udev/rules.d/81-ccw-ifname.rules fi done - -znet_cio_free |