Hello community,

here is the log from the commit of package combustion for openSUSE:Factory 
checked in at 2020-09-12 00:10:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/combustion (Old)
 and      /work/SRC/openSUSE:Factory/.combustion.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "combustion"

Sat Sep 12 00:10:55 2020 rev:2 rq:833734 version:0.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/combustion/combustion.changes    2020-07-24 
10:01:26.149725694 +0200
+++ /work/SRC/openSUSE:Factory/.combustion.new.4249/combustion.changes  
2020-09-12 00:11:30.817156787 +0200
@@ -1,0 +2,11 @@
+Fri Sep  4 14:27:17 UTC 2020 - Fabian Vogt <[email protected]>
+
+- Add combustion-prepare.service to enable network if needed:
+  M combustion
+  A combustion-prepare.service
+  M combustion.service
+  M module-setup.sh
+- Don't fail if no config drive found to not break ignition with
+  fw_cfg
+
+-------------------------------------------------------------------

New:
----
  combustion-prepare.service

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ combustion.spec ++++++
--- /var/tmp/diff_new_pack.8YETPD/_old  2020-09-12 00:11:33.645159493 +0200
+++ /var/tmp/diff_new_pack.8YETPD/_new  2020-09-12 00:11:33.649159497 +0200
@@ -27,7 +27,8 @@
 Source2:        README
 Source3:        module-setup.sh
 Source4:        combustion.service
-Source5:        combustion
+Source5:        combustion-prepare.service
+Source6:        combustion
 Requires:       ignition-dracut-grub2
 BuildArch:      noarch
 
@@ -51,7 +52,8 @@
 cd %{buildroot}%{_prefix}/lib/dracut/modules.d/35combustion/
 install -m0644 %{SOURCE3} module-setup.sh
 install -m0644 %{SOURCE4} combustion.service
-install -m0755 %{SOURCE5} combustion
+install -m0644 %{SOURCE5} combustion-prepare.service
+install -m0755 %{SOURCE6} combustion
 
 %post
 %{?regenerate_initrd_post}

++++++ README ++++++
--- /var/tmp/diff_new_pack.8YETPD/_old  2020-09-12 00:11:33.701159546 +0200
+++ /var/tmp/diff_new_pack.8YETPD/_new  2020-09-12 00:11:33.705159550 +0200
@@ -29,6 +29,7 @@
 mkdir -p /mnt/combustion/
 cat >/mnt/combustion/script <<EOF
 #!/bin/sh
+# combustion: network
 systemctl enable sshd.service
 zypper --non-interactive install vim-small
 cp welcome /root/welcome
@@ -37,6 +38,9 @@
 umount /mnt
 ```
 
+The "# combustion: network" comment indicates that network needs to be
+configured before running the script.
+
 You can do everything necessary for initial system configuration from this
 script, including addition of ssh keys, adding users, changing passwords
 or even doing partitioning changes.
@@ -50,13 +54,18 @@
 
 If this option is found on the kernel cmdline, combustion.service's
 ConditionKernelCommandLine is fulfilled and it'll be required by initrd.target.
-It is started after /sysroot is mounted and network is up (if enabled). This
-service tries to activate all mountpoints in the system's /etc/fstab and then
-calls transactional-update chrooted.
+This pulls in combustion-prepare.service, which runs after the config drive
+with LABEL=ignition appears. It is mounted and if the "network" flag comment is
+present, enables networking for later. After /sysroot is mounted and network is
+up (if enabled), combustion.service runs, which tries to activate all
+mountpoints in the system's /etc/fstab and then calls transactional-update
+in a chroot.
 
 In this transactional-update session the script is started and the exit code
 recorded. If the script failed, transactional-update rollback is called and
-combustion.service marked as failed.
+combustion.service marked as failed, which causes booting to fail. Note that a
+missing config drive or script is not considered a fatal error and only results
+in a warning.
 
 /sysroot is unmounted and mounted again, so that the default subvolume gets
 reevaluated and directly booted into.

++++++ combustion ++++++
--- /var/tmp/diff_new_pack.8YETPD/_old  2020-09-12 00:11:33.721159565 +0200
+++ /var/tmp/diff_new_pack.8YETPD/_new  2020-09-12 00:11:33.721159565 +0200
@@ -3,7 +3,39 @@
 # SPDX-License-Identifier: GPL-2.0-only
 set -euo pipefail
 
-config_mount="/mnt/combustion"
+config_mount="/run/combustion/mount"
+
+if [ "${1-}" = "--prepare" ]; then
+       # Mount config drive
+       mkdir -p "${config_mount}"
+
+       if ! [ -e /dev/disk/by-label/ignition ]; then
+               echo "No config drive found"
+               exit 0
+       fi
+
+       if ! mount -o ro /dev/disk/by-label/ignition "${config_mount}"; then
+               echo "Failed to mount config drive!"
+               exit 1
+       fi
+
+       # Check for the magic flag "# combustion: network" in the script
+       if [ -e "${config_mount}/combustion/script" ] \
+          && grep -qE '^# combustion:(.*)\<network\>' 
"${config_mount}/combustion/script"; then
+               sh -s <<EOF
+                       . /lib/dracut-lib.sh
+                       getargbool 0 'rd.neednet' && exit 0
+                       echo rd.neednet=1  > 
/etc/cmdline.d/40-combustion-neednet.conf
+                       # Re-trigger generation of network rules and apply them
+                       . /lib/dracut/hooks/pre-udev/60-net-genrules.sh
+                       udevadm control --reload
+                       udevadm trigger --subsystem-match net --action add
+EOF
+       fi
+
+       exit 0
+fi
+
 # Use /dev/shm for data exchange
 exchangedir="/dev/shm/combustion/"
 delete_resolv_conf=0
@@ -27,13 +59,6 @@
 
 trap cleanup EXIT
 
-# Mount config drive
-mkdir -p "${config_mount}"
-if ! mount -o ro /dev/disk/by-label/ignition "${config_mount}"; then
-       echo "Failed to mount config drive!"
-       exit 1
-fi
-
 if ! [ -d "${config_mount}/combustion" ]; then
        echo "No config found - doing nothing."
        exit 0

++++++ combustion-prepare.service ++++++
[Unit]
Description=Combustion (preparations)
DefaultDependencies=false

ConditionKernelCommandLine=ignition.firstboot

# Config drive has to be available
Wants=dev-disk-by\x2dlabel-ignition.device
After=dev-disk-by\x2dlabel-ignition.device

# This reconfigures networking, which runs during the initqueue
Before=dracut-initqueue.service

Conflicts=initrd-switch-root.target umount.target
Conflicts=dracut-emergency.service emergency.service emergency.target

# Without this it goes into an endless loop on failure
OnFailure=emergency.target
OnFailureJobMode=isolate

[Service]
Type=oneshot
ExecStart=/usr/bin/combustion --prepare
++++++ combustion.service ++++++
--- /var/tmp/diff_new_pack.8YETPD/_old  2020-09-12 00:11:33.761159603 +0200
+++ /var/tmp/diff_new_pack.8YETPD/_new  2020-09-12 00:11:33.761159603 +0200
@@ -7,13 +7,13 @@
 Requires=sysroot.mount
 After=sysroot.mount
 
+# combustion-prepare sets up network, if required
+Requires=combustion-prepare.service
+After=combustion-prepare.service
+
 # Optionally make network available
 After=network.target
 
-# Config drive has to be available
-Requires=dev-disk-by\x2dlabel-ignition.device
-After=dev-disk-by\x2dlabel-ignition.device
-
 # After ignition completed its stuff
 After=ignition-complete.target
 
@@ -23,6 +23,10 @@
 Conflicts=initrd-switch-root.target umount.target
 Conflicts=dracut-emergency.service emergency.service emergency.target
 
+# Without this it goes into an endless loop on failure
+OnFailure=emergency.target
+OnFailureJobMode=isolate
+
 [Service]
 Type=oneshot
 ExecStart=/usr/bin/combustion

++++++ module-setup.sh ++++++
--- /var/tmp/diff_new_pack.8YETPD/_old  2020-09-12 00:11:33.785159627 +0200
+++ /var/tmp/diff_new_pack.8YETPD/_new  2020-09-12 00:11:33.785159627 +0200
@@ -4,6 +4,7 @@
 
 install() {
        inst_simple "${moddir}/combustion.service" 
"${systemdsystemunitdir}/combustion.service"
+       inst_simple "${moddir}/combustion-prepare.service" 
"${systemdsystemunitdir}/combustion-prepare.service"
        mkdir -p "${initdir}/${systemdsystemunitdir}/initrd.target.requires/"
        ln_r "../combustion.service" 
"${systemdsystemunitdir}/initrd.target.requires/combustion.service"
        inst_multiple awk chroot findmnt 


Reply via email to