From 5ab91da34b7c2df9a85cfe8e84ce3323e490e80f Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Mon, 30 Mar 2020 12:07:24 -0400 Subject: [PATCH] WIP: Add new ignition-fetch-offline.service See https://github.com/coreos/ignition/pull/956. --- .../30ignition/ignition-fetch-offline.service | 18 ++++++++++++++++++ dracut/30ignition/ignition-fetch.service | 14 +++++++------- dracut/30ignition/module-setup.sh | 1 + 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 dracut/30ignition/ignition-fetch-offline.service diff --git a/dracut/30ignition/ignition-fetch-offline.service b/dracut/30ignition/ignition-fetch-offline.service new file mode 100644 index 0000000..dc1373d --- /dev/null +++ b/dracut/30ignition/ignition-fetch-offline.service @@ -0,0 +1,18 @@ +[Unit] +Description=Ignition (fetch-offline) +Documentation=https://github.com/coreos/ignition +ConditionPathExists=/etc/initrd-release +DefaultDependencies=false +Before=ignition-complete.target +After=basic.target + +# Run after ignition-setup has run because ignition-setup +# may copy in new/different ignition configs for us to consume. +After=ignition-setup-base.service +After=ignition-setup-user.service + +[Service] +Type=oneshot +RemainAfterExit=yes +EnvironmentFile=/run/ignition.env +ExecStart=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=fetch-offline diff --git a/dracut/30ignition/ignition-fetch.service b/dracut/30ignition/ignition-fetch.service index b9e1cec..3402388 100644 --- a/dracut/30ignition/ignition-fetch.service +++ b/dracut/30ignition/ignition-fetch.service @@ -5,17 +5,17 @@ ConditionPathExists=/etc/initrd-release DefaultDependencies=false Before=ignition-complete.target After=basic.target +ConditionPathExists=/run/ignition/neednet -# Run after ignition-setup has run because ignition-setup -# may copy in new/different ignition configs for us to consume. -After=ignition-setup-base.service -After=ignition-setup-user.service - -# Network may be used to fetch userdata content. -After=network.target +Requires=ignition-fetch-offline.service +After=ignition-fetch-offline.service [Service] Type=oneshot RemainAfterExit=yes EnvironmentFile=/run/ignition.env +# The reason for this awkward bit here is that having +# Wants=network-online.target will cause systemd to always start networking +# even if ConditionPathExists fails. +ExecStart=/usr/bin/systemctl start network-online.target ExecStart=/usr/bin/ignition --root=/sysroot --platform=${PLATFORM_ID} --stage=fetch diff --git a/dracut/30ignition/module-setup.sh b/dracut/30ignition/module-setup.sh index a117fbe..a96684d 100755 --- a/dracut/30ignition/module-setup.sh +++ b/dracut/30ignition/module-setup.sh @@ -71,6 +71,7 @@ install() { install_ignition_unit ignition-setup-base.service install_ignition_unit ignition-setup-user.service install_ignition_unit ignition-fetch.service + install_ignition_unit ignition-fetch-offline.service install_ignition_unit ignition-disks.service install_ignition_unit ignition-mount.service install_ignition_unit ignition-files.service