From 3a12418b0e25bb39a5a3d33ee6ad55aa32a5414de222bcd036e411f2c229b216 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Tue, 6 Oct 2020 13:08:49 +0000 Subject: [PATCH] Accepting request 839820 from home:favogt:combustion - Implement support for systems without transactional-update - Require rmdir explicitly - Fail properly when the retval file doesn't exist - Stop ignition-mount.service to avoid conflict (boo#1176746) OBS-URL: https://build.opensuse.org/request/show/839820 OBS-URL: https://build.opensuse.org/package/show/devel:kubic:ignition/combustion?expand=0&rev=9 --- combustion | 44 ++++++++++++++++++++++++++++++-------------- combustion.changes | 12 ++++++++++++ module-setup.sh | 2 +- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/combustion b/combustion index cecc4f2..c13a752 100644 --- a/combustion +++ b/combustion @@ -89,6 +89,13 @@ if ! [ -d "${config_mount}/combustion" ]; then exit 0 fi +# ignition-mount.service mounts stuff below /sysroot in ExecStart and umounts +# it on ExecStop, failing if umounting fails. This conflicts with the +# mounts/umounts done by combustion. Ignition is already done, so just stop it. +if systemctl --quiet is-active ignition-mount.service; then + systemctl stop ignition-mount.service +fi + # Copy config mkdir "${exchangedir}" config_dir="${exchangedir}/config" @@ -125,20 +132,29 @@ if [ -r /etc/resolv.conf ]; then fi fi -# t-u doesn't allow running arbitrary commands and -# also ignores the shell's exit code, so DIY. -if ! chroot /sysroot transactional-update shell < "${exchangedir}/retval" +if [ -x /sysroot/usr/sbin/transactional-update ]; then + # t-u doesn't allow running arbitrary commands and + # also ignores the shell's exit code, so DIY. + if ! chroot /sysroot transactional-update shell < "${exchangedir}/retval" EOF - echo "transactional-update failed" - exit 1 -fi + echo "transactional-update failed" + exit 1 + fi -if [ "$(cat "${exchangedir}/retval")" -ne 0 ]; then - echo "Command failed, rolling back" - chroot /sysroot transactional-update --no-selfupdate rollback - exit 1 + if ! [ -e "${exchangedir}/retval" ] || [ "$(cat "${exchangedir}/retval")" -ne 0 ]; then + echo "Command failed, rolling back" + chroot /sysroot transactional-update --no-selfupdate rollback + exit 1 + fi +else + mount -o remount,rw /sysroot + if ! chroot /sysroot sh -e -c "cd '${config_dir}'; chmod a+x script; ./script"; then + echo "Command failed" + exit 1 + fi + chroot /sysroot snapper --no-dbus create -d "After combustion configuration" || : fi diff --git a/combustion.changes b/combustion.changes index 578d874..bdf662f 100644 --- a/combustion.changes +++ b/combustion.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Tue Oct 6 10:19:57 UTC 2020 - Fabian Vogt + +- Implement support for systems without transactional-update +- Require rmdir explicitly + +------------------------------------------------------------------- +Mon Oct 5 08:33:19 UTC 2020 - Fabian Vogt + +- Fail properly when the retval file doesn't exist +- Stop ignition-mount.service to avoid conflict (boo#1176746) + ------------------------------------------------------------------- Thu Sep 17 10:56:44 UTC 2020 - Fabian Vogt diff --git a/module-setup.sh b/module-setup.sh index 859f794..89c0209 100644 --- a/module-setup.sh +++ b/module-setup.sh @@ -8,7 +8,7 @@ install() { inst_simple "${moddir}/combustion.rules" "/etc/udev/rules.d/70-combustion.rules" mkdir -p "${initdir}/${systemdsystemunitdir}/initrd.target.requires/" ln_r "../combustion.service" "${systemdsystemunitdir}/initrd.target.requires/combustion.service" - inst_multiple awk chroot findmnt + inst_multiple awk chroot findmnt rmdir inst_simple "${moddir}/combustion" "/usr/bin/combustion" # Wait up to 10s (30s on aarch64) for the config drive