diff --git a/overlay.d/05core/usr/lib/dracut/modules.d/39coreos-ignitionnetwork/coreos-NetworkManager.service b/overlay.d/05core/usr/lib/dracut/modules.d/39coreos-ignitionnetwork/coreos-NetworkManager.service new file mode 100644 index 0000000000..4431919946 --- /dev/null +++ b/overlay.d/05core/usr/lib/dracut/modules.d/39coreos-ignitionnetwork/coreos-NetworkManager.service @@ -0,0 +1,12 @@ +[Unit] +Description=Network Manager (CoreOS initrd) +Wants=network.target +After=network-pre.target dbus.service +Before=network.target network.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/libexec/nm-initrd-generator rd.neednet=1 ip=dhcp,dhcp6 +ExecStart=/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon +CapabilityBoundingSet=CAP_NET_ADMIN CAP_DAC_OVERRIDE CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID CAP_SYS_MODULE CAP_AUDIT_WRITE CAP_KILL CAP_SYS_CHROOT diff --git a/overlay.d/05core/usr/lib/dracut/modules.d/39coreos-ignitionnetwork/module-setup.sh b/overlay.d/05core/usr/lib/dracut/modules.d/39coreos-ignitionnetwork/module-setup.sh new file mode 100755 index 0000000000..a56e32e22f --- /dev/null +++ b/overlay.d/05core/usr/lib/dracut/modules.d/39coreos-ignitionnetwork/module-setup.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +depends() { + echo ignition network-manager +} + +install_and_enable_unit() { + unit="$1"; shift + target="$1"; shift + inst_simple "$moddir/$unit" "$systemdsystemunitdir/$unit" + mkdir -p "$initdir/$systemdsystemunitdir/$target.requires" + ln_r "../$unit" "$systemdsystemunitdir/$target.requires/$unit" +} + +install() { + # We're forcibly overriding NM to be run as a service + install_and_enable_unit coreos-NetworkManager.service network-online.target + fetchd="$initdir/$systemdsystemunitdir/ignition-fetch.service.d/" + mkdir -p "${fetchd}" + cat >${fetchd}/nm-online.conf << EOF +[Unit] +After=network-online.target +Wants=network-online.target +EOF +}