zdev/dracut: fix marking hostonly files so delete option works

Chzdev import generates persistent device configuration which are hostonly
files. Dracut cmdline rd.hostonly=0 should be able to delete those.

Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/158
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
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>
This commit is contained in:
Steffen Maier
2023-01-19 19:09:04 +01:00
committed by Jan Höppner
parent 63f31bf73e
commit d96767ee45

View File

@@ -107,5 +107,19 @@ install() {
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
local _nullglob
_nullglob=$(shopt -p nullglob)
shopt -u nullglob
readarray -t _array < \
<(ls -1 "$initdir"/etc/udev/rules.d/41-*.rules 2> /dev/null)
[[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}"
readarray -t _array < \
<(ls -1 "$initdir"/etc/modprobe.d/s390x-*.conf 2> /dev/null)
[[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}"
$_nullglob
return 0
}