Skip to content

Commit 8ec9a33

Browse files
jbtrystramtravier
authored andcommitted
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 #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: coreos/fedora-coreos-tracker#1468 See: coreos/fedora-coreos-config#3042 Initial version from: #716 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2332868
1 parent 2a2a0f0 commit 8ec9a33

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ install-grub-static:
4141
install -m 644 -D -t ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static src/grub2/*.cfg
4242
install -m 755 -d ${DESTDIR}$(PREFIX)/lib/bootupd/grub2-static/configs.d
4343

44+
install-systemd-unit:
45+
install -m 644 -D -t "${DESTDIR}$(PREFIX)/lib/systemd/system/" contrib/packaging/bootloader-update.service
46+
4447
bin-archive:
4548
rm target/inst -rf
4649
$(MAKE) install install-grub-static DESTDIR=$$(pwd)/target/inst
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Update bootloader on boot
3+
Documentation=https://github.com/coreos/bootupd
4+
5+
[Service]
6+
Type=oneshot
7+
ExecStart=/usr/bin/bootupctl update
8+
RemainAfterExit=yes
9+
MountFlags=slave
10+
11+
[Install]
12+
WantedBy=multi-user.target

contrib/packaging/bootupd.spec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ BuildRequires: cargo
2424
BuildRequires: git
2525
BuildRequires: openssl-devel
2626
BuildRequires: systemd-devel
27+
BuildRequires: systemd-rpm-macros
2728

2829
%description
2930
%{summary}
@@ -34,6 +35,7 @@ BuildRequires: systemd-devel
3435
%{_bindir}/bootupctl
3536
%{_libexecdir}/bootupd
3637
%{_prefix}/lib/bootupd/grub2-static/
38+
%{_unitdir}/bootloader-update.service
3739

3840
%prep
3941
%autosetup -n %{crate}-%{version} -p1 -Sgit
@@ -53,6 +55,7 @@ cargo build --release
5355
%install
5456
%make_install INSTALL="install -p -c"
5557
make install-grub-static DESTDIR=%{?buildroot} INSTALL="%{__install} -p"
58+
make install-systemd-unit DESTDIR=%{?buildroot} INSTALL="%{__install} -p"
5659

5760
%changelog
5861
* Tue Oct 18 2022 Colin Walters <[email protected]> - 0.2.8-3

0 commit comments

Comments
 (0)