From 8ec9a33228afb4028e209988386657792fb260bd Mon Sep 17 00:00:00 2001 From: jbtrystram Date: Tue, 3 Sep 2024 09:34:18 +0200 Subject: [PATCH 1/2] packaging: Add systemd unit to trigger updates on boot Add a systemd service unit to trigger an adoption and update on every 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 auto-update for the bootloader is desired. This unit does not come with any specific restrictions (i.e. EFI or BIOS only). For an assesment of the safety of updates as performed by bootupd, see https://github.com/coreos/bootupd/issues/454. Distributiuons should also apply the restrictions (i.e. EFI or BIOS only for example) as needed as unit files overrides. Notably, Fedora CoreOS can not yet enable automatic updates until we get support for the multiple EFI partitions for RAID setups. See: https://github.com/coreos/fedora-coreos-tracker/issues/1468 See: https://github.com/coreos/fedora-coreos-config/pull/3042 Initial version from: https://github.com/coreos/bootupd/pull/716 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2332868 --- Makefile | 3 +++ contrib/packaging/bootloader-update.service | 12 ++++++++++++ contrib/packaging/bootupd.spec | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 contrib/packaging/bootloader-update.service diff --git a/Makefile b/Makefile index f5292a4c..59c212c9 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,9 @@ install-grub-static: install -m 644 -D -t ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static src/grub2/*.cfg install -m 755 -d ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static/configs.d +install-systemd-unit: + install -m 644 -D -t "${DESTDIR}$(PREFIX)/lib/systemd/system/" contrib/packaging/bootloader-update.service + bin-archive: rm target/inst -rf $(MAKE) install install-grub-static DESTDIR=$$(pwd)/target/inst diff --git a/contrib/packaging/bootloader-update.service b/contrib/packaging/bootloader-update.service new file mode 100644 index 00000000..065f1730 --- /dev/null +++ b/contrib/packaging/bootloader-update.service @@ -0,0 +1,12 @@ +[Unit] +Description=Update bootloader on boot +Documentation=https://github.com/coreos/bootupd + +[Service] +Type=oneshot +ExecStart=/usr/bin/bootupctl update +RemainAfterExit=yes +MountFlags=slave + +[Install] +WantedBy=multi-user.target diff --git a/contrib/packaging/bootupd.spec b/contrib/packaging/bootupd.spec index 53c8fdd3..a44a2664 100644 --- a/contrib/packaging/bootupd.spec +++ b/contrib/packaging/bootupd.spec @@ -24,6 +24,7 @@ BuildRequires: cargo BuildRequires: git BuildRequires: openssl-devel BuildRequires: systemd-devel +BuildRequires: systemd-rpm-macros %description %{summary} @@ -34,6 +35,7 @@ BuildRequires: systemd-devel %{_bindir}/bootupctl %{_libexecdir}/bootupd %{_prefix}/lib/bootupd/grub2-static/ +%{_unitdir}/bootloader-update.service %prep %autosetup -n %{crate}-%{version} -p1 -Sgit @@ -53,6 +55,7 @@ cargo build --release %install %make_install INSTALL="install -p -c" make install-grub-static DESTDIR=%{?buildroot} INSTALL="%{__install} -p" +make install-systemd-unit DESTDIR=%{?buildroot} INSTALL="%{__install} -p" %changelog * Tue Oct 18 2022 Colin Walters - 0.2.8-3 From a62fcbc4b66e6116c0fc53cdc0ed7c528752952c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Wed, 18 Dec 2024 12:14:16 +0100 Subject: [PATCH 2/2] contrib/packaging/bootupd.spec: Fix EOL at EOF --- contrib/packaging/bootupd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/packaging/bootupd.spec b/contrib/packaging/bootupd.spec index a44a2664..b6db508f 100644 --- a/contrib/packaging/bootupd.spec +++ b/contrib/packaging/bootupd.spec @@ -59,4 +59,4 @@ make install-systemd-unit DESTDIR=%{?buildroot} INSTALL="%{__install} -p" %changelog * Tue Oct 18 2022 Colin Walters - 0.2.8-3 -- Dummy changelog \ No newline at end of file +- Dummy changelog