summaryrefslogtreecommitdiffstats
path: root/modules.d/95qeth_rules
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
commit9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a (patch)
tree2efb72864cc69e174c9c5ee33efb88a5f1553b48 /modules.d/95qeth_rules
parentInitial commit. (diff)
downloaddracut-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 'modules.d/95qeth_rules')
-rwxr-xr-xmodules.d/95qeth_rules/module-setup.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/modules.d/95qeth_rules/module-setup.sh b/modules.d/95qeth_rules/module-setup.sh
new file mode 100755
index 0000000..a84ac15
--- /dev/null
+++ b/modules.d/95qeth_rules/module-setup.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# called by dracut
+check() {
+ local _arch=${DRACUT_ARCH:-$(uname -m)}
+ local _online=0
+ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
+ dracut_module_included network || return 1
+
+ [[ $hostonly ]] && {
+ for i in /sys/devices/qeth/*/online; do
+ [ ! -f "$i" ] && continue
+ read -r _online < "$i"
+ [ "$_online" -eq 1 ] && return 0
+ done
+ }
+ return 255
+}
+
+# called by dracut
+installkernel() {
+ instmods qeth
+}
+
+# called by dracut
+install() {
+ ccwid() {
+ qeth_path=$(readlink -e -q "$1"/device)
+ basename "$qeth_path"
+ }
+
+ inst_rules_qeth() {
+ for rule in /etc/udev/rules.d/{4,5}1-qeth-${1}.rules; do
+ # prefer chzdev generated 41- rules
+ if [ -f "$rule" ]; then
+ inst_rules "$rule"
+ break
+ fi
+ done
+ }
+
+ has_carrier() {
+ carrier=0
+ # not readable in qeth interfaces
+ # that have just been assembled, ignore
+ # read error and assume no carrier
+ read -r carrier 2> /dev/null < "$1/carrier"
+ [ "$carrier" -eq 1 ] && return 0
+ return 1
+ }
+
+ for dev in /sys/class/net/*; do
+ has_carrier "$dev" || continue
+ id=$(ccwid "$dev")
+ [ -n "$id" ] && inst_rules_qeth "$id"
+ done
+
+}