Don't run the new systemd unit (nm-run.service) if rd.neednet=1
isn't set. nm-initrd-generator will generate configuration even
without rd.neednet=1 so determining if we should start based on
just if connection profiles exist isn't enough. We need some other
indicator. In this case we lay down a /run/NetworkManager/initrd/neednet
if rd.neednet=1, which is used by nm-run.service to determine the
need to run.
/etc/sysconfig/network-scripts/ifcfg-*; do
[ -f "$i" ] || continue
echo '[ -f /tmp/nm.done ]' > "$hookdir"/initqueue/finished/nm.sh
+ : > /run/NetworkManager/initrd/neednet # activate nm-run.service
break
done
fi
#run before we try to mount anything from the dracut hooks
Before=dracut-initqueue.service
+#do not run if networking not needed
+ConditionPathExists=/run/NetworkManager/initrd/neednet
+
#do not run, if there is no configuration
ConditionPathExistsGlob=|/usr/lib/NetworkManager/system-connections/*
ConditionPathExistsGlob=|/run/NetworkManager/system-connections/*