pivot to a systemd unit for the online hook

This commit is contained in:
Audiobuzz
2026-06-15 08:52:19 +00:00
parent 2eefd97c50
commit 62e49e6b42
6 changed files with 88 additions and 37 deletions
+14 -4
View File
@@ -42,10 +42,20 @@ install() {
# Hook: runs from the initqueue once the NIC exists, before netroot
inst_hook initqueue/settled 30 "$moddir/dot1x-macsec-up.sh"
# Test-mode (rd.dot1x=0) NVMe-oF connect, driven event-wise on link-up.
# This distro's nvmf module registers no autoconnect, and a main-initqueue
# job isn't re-run once the loop waits on events — so connect here instead.
inst_hook initqueue/online 90 "$moddir/nvmf-connect.sh"
# Test-mode (rd.dot1x=0) NVMe-oF connect as a systemd unit. This initramfs
# is systemd-driven and does NOT source dracut initqueue/online hooks when
# the ip=dhcp link comes up (verified: the hook installs but never fires),
# and the nvmf module registers no autoconnect — so a dracut hook never
# runs. A oneshot unit ordered Before=initrd-root-device.target, with its
# own wait-for-network + connect loop, connects the namespace
# deterministically. ConditionKernelCommandLine=rd.dot1x=0 makes it a no-op
# on the secure path.
inst_simple "$moddir/nvmf-connect.sh" /usr/sbin/nvmf-connect
inst_simple "$moddir/nvmf-connect.service" \
"$systemdsystemunitdir/nvmf-connect.service"
mkdir -p "${initdir}${systemdsystemunitdir}/initrd-root-device.target.wants"
ln -sf ../nvmf-connect.service \
"${initdir}${systemdsystemunitdir}/initrd-root-device.target.wants/nvmf-connect.service"
dracut_need_initqueue
}