summaryrefslogtreecommitdiffstats
path: root/modules.d/95znet/module-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/95znet/module-setup.sh')
-rwxr-xr-xmodules.d/95znet/module-setup.sh37
1 files changed, 34 insertions, 3 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
}