Skip to content

Commit

Permalink
fix(network-manager): use /run/NetworkManager/initrd/neednet in initq…
Browse files Browse the repository at this point in the history
…ueue

We don't want to start NetworkManager if networking is not needed.
Right now nm-config.sh lays down /usr/lib/dracut/hooks/initqueue/finished/nm.sh
which will cause the initqueue to run. If nothing exists in
/usr/lib/dracut/hooks/initqueue/finished/ then it will short circuit and
the initqueue won't run anything. But what if something else needed
something to run in the initqueue? nm-run.sh would still get started,
even though /usr/lib/dracut/hooks/initqueue/finished/nm.sh didn't exist.
In this case let's just trigger off of /run/NetworkManager/initrd/neednet
like we are doing in the systemd unit (nm-run.service).
  • Loading branch information
dustymabe authored and haraldh committed Apr 16, 2021
1 parent ac0e8f7 commit 6a37c6f
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions modules.d/35network-manager/nm-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ if [ -e /tmp/nm.done ]; then
return
fi

[ -z "$DRACUT_SYSTEMD" ] \
&& for i in /usr/lib/NetworkManager/system-connections/* \
/run/NetworkManager/system-connections/* \
/etc/NetworkManager/system-connections/* \
/etc/sysconfig/network-scripts/ifcfg-*; do
[ -f "$i" ] || continue
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
break
done
if [ -z "$DRACUT_SYSTEMD" ]; then
# Only start NM if networking is needed
if [ -e /run/NetworkManager/initrd/neednet ]; then
for i in /usr/lib/NetworkManager/system-connections/* \
/run/NetworkManager/system-connections/* \
/etc/NetworkManager/system-connections/* \
/etc/sysconfig/network-scripts/ifcfg-*; do
[ -f "$i" ] || continue
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
break
done
fi
fi

if [ -s /run/NetworkManager/initrd/hostname ]; then
cat /run/NetworkManager/initrd/hostname > /proc/sys/kernel/hostname
Expand Down

0 comments on commit 6a37c6f

Please sign in to comment.