From d96767ee45a757a7891cf6700fa74ca447d4c664 Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Thu, 19 Jan 2023 19:09:04 +0100 Subject: [PATCH] zdev/dracut: fix marking hostonly files so delete option works MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Vineeth Vijayan Acked-by: Peter Oberparleiter Signed-off-by: Steffen Maier Signed-off-by: Jan Höppner --- zdev/dracut/95zdev/module-setup.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zdev/dracut/95zdev/module-setup.sh b/zdev/dracut/95zdev/module-setup.sh index 95351d64..5da77327 100644 --- a/zdev/dracut/95zdev/module-setup.sh +++ b/zdev/dracut/95zdev/module-setup.sh @@ -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 }