]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(nvmf): move /etc/nvme/host{nqn,id} requirement to hostonly
authorTomas Bzatek <tbzatek@redhat.com>
Thu, 21 Sep 2023 12:31:07 +0000 (14:31 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Mon, 8 Apr 2024 21:34:54 +0000 (17:34 -0400)
When creating initramfs for universal boot image such as an installer,
we can't include any machine-specific IDs. Let's move the check
for /etc/nvme/hostnqn and /etc/nvme/hostid files presence to
the hostonly section to avoid unsatisfied requirements.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
modules.d/95nvmf/module-setup.sh

index a8f3034143e4414e980b5e96111307fd13a93044..6a1e3f5bcb336c2e3791698fa131bc82790a2efc 100755 (executable)
@@ -3,8 +3,6 @@
 # called by dracut
 check() {
     require_binaries nvme jq || return 1
-    [ -f /etc/nvme/hostnqn ] || return 255
-    [ -f /etc/nvme/hostid ] || return 255
 
     is_nvmf() {
         local _dev=$1
@@ -36,6 +34,8 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
+        [ -f /etc/nvme/hostnqn ] || return 255
+        [ -f /etc/nvme/hostid ] || return 255
         pushd . > /dev/null
         for_each_host_dev_and_slaves is_nvmf
         local _is_nvmf=$?
@@ -130,8 +130,8 @@ install() {
         _nvmf_args=$(cmdline)
         [[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf"
     fi
-    inst_simple "/etc/nvme/hostnqn"
-    inst_simple "/etc/nvme/hostid"
+    inst_simple -H "/etc/nvme/hostnqn"
+    inst_simple -H "/etc/nvme/hostid"
 
     inst_multiple ip sed