From b32bce4f74c48e417679433bc88d98caf3038389d06d2c78292c7024db846c9d Mon Sep 17 00:00:00 2001 From: Ignaz Forster Date: Mon, 10 Aug 2020 09:28:39 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/devel:kubic:ignition/ignition?expand=0&rev=50 --- ignition-enable-network.service | 23 +++++++++++++++++++++++ ignition-enable-network.sh | 10 ++++++++++ 2 files changed, 33 insertions(+) create mode 100644 ignition-enable-network.service create mode 100644 ignition-enable-network.sh diff --git a/ignition-enable-network.service b/ignition-enable-network.service new file mode 100644 index 0000000..4598c57 --- /dev/null +++ b/ignition-enable-network.service @@ -0,0 +1,23 @@ +[Unit] +Description=Start network if needed +ConditionPathExists=/etc/initrd-release +DefaultDependencies=false +After=basic.target + +# Triggering conditions for cases where we need network +ConditionPathExists=|/run/ignition/neednet + +# Creates /run/ignition/neednet +After=ignition-fetch-offline.service +# Needs networking +Before=ignition-fetch.service + +# See hack in coreos-enable-network, as well as coreos-copy-firstboot-network.service; +# adapted for SUSE / wicked use +After=dracut-cmdline.service +Before=dracut-initqueue.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/sbin/ignition-enable-network diff --git a/ignition-enable-network.sh b/ignition-enable-network.sh new file mode 100644 index 0000000..4d9c5b3 --- /dev/null +++ b/ignition-enable-network.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. /lib/dracut-lib.sh + +if [ -f /run/ignition/neednet ] && ! getargbool 0 'rd.neednet'; then + echo "rd.neednet=1 ip=dhcp" > /etc/cmdline.d/40-ignition-neednet.conf + + # Re-trigger generation of network rules + . /lib/dracut/hooks/pre-udev/60-net-genrules.sh +fi