From 4a65f3b2e94b2a06d67b98197850f5f0c5d7202c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Wed, 18 Dec 2024 12:29:35 +0100 Subject: [PATCH] migrate: Add systemd service unit to trigger on boot Note that the service is intentionally not enabled by default as it should be up to the distribution to add a systemd preset if the migration to a static GRUB config is needed. This will be used on Atomic Desktops & IoT systems to migrate systems to a static GRUB config before enabling composefs as GRUB curently does not interact well with it: https://bugzilla.redhat.com/show_bug.cgi?id=2308594 See: https://github.com/coreos/bootupd/issues/789 See: https://fedoraproject.org/wiki/Changes/ComposefsAtomicDesktops --- Makefile | 1 + .../bootupd-static-grub-migration.service | 17 +++++++++++++++++ contrib/packaging/bootupd.spec | 1 + 3 files changed, 19 insertions(+) create mode 100644 contrib/packaging/bootupd-static-grub-migration.service diff --git a/Makefile b/Makefile index 59c212c9..f977008b 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ install-grub-static: install-systemd-unit: install -m 644 -D -t "${DESTDIR}$(PREFIX)/lib/systemd/system/" contrib/packaging/bootloader-update.service + install -m 644 -D -t "${DESTDIR}$(PREFIX)/lib/systemd/system/" contrib/packaging/bootupd-static-grub-migration.service bin-archive: rm target/inst -rf diff --git a/contrib/packaging/bootupd-static-grub-migration.service b/contrib/packaging/bootupd-static-grub-migration.service new file mode 100644 index 00000000..5f726f17 --- /dev/null +++ b/contrib/packaging/bootupd-static-grub-migration.service @@ -0,0 +1,17 @@ +[Unit] +Description=bootupd static GRUB config migration +Documentation=https://github.com/coreos/bootupd +ConditionPathExists=!/boot/.bootupd-static-migration-complete +RequiresMountsFor=/sysroot /boot +# Only run after a successful bootloader update +After=bootloader-update.service +Requires=bootloader-update.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/bootupctl migrate +RemainAfterExit=yes +MountFlags=slave + +[Install] +WantedBy=multi-user.target diff --git a/contrib/packaging/bootupd.spec b/contrib/packaging/bootupd.spec index b6db508f..6d096c15 100644 --- a/contrib/packaging/bootupd.spec +++ b/contrib/packaging/bootupd.spec @@ -36,6 +36,7 @@ BuildRequires: systemd-rpm-macros %{_libexecdir}/bootupd %{_prefix}/lib/bootupd/grub2-static/ %{_unitdir}/bootloader-update.service +%{_unitdir}/bootupd-static-grub-migration.service %prep %autosetup -n %{crate}-%{version} -p1 -Sgit