mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-27 23:34:51 +00:00
spec: Use systemd presets and macros for units in tools package
Resolves: #2230575 Signed-off-by: Christian Glombek <cglombek@redhat.com>
This commit is contained in:
parent
5c4529ecac
commit
d161705351
3 changed files with 76 additions and 15 deletions
52
0335-Add-Install-section-to-aux-systemd-units.patch
Normal file
52
0335-Add-Install-section-to-aux-systemd-units.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Glombek <cglombek@redhat.com>
|
||||
Date: Wed, 9 Aug 2023 18:11:25 +0200
|
||||
Subject: [PATCH] Add [Install] section to aux systemd units
|
||||
|
||||
Currently in Fedora, these services are statically enabled by symlinks,
|
||||
with no other way to disable them than to manually delete those symlinks.
|
||||
This is problematic in Fedora IoT, where grub-boot-success.timer is
|
||||
not supposed to be enabled.
|
||||
|
||||
This change adds `[Install]` sections to all systemd units that are
|
||||
currently enabled statically, so that they can be enabled dynamically
|
||||
via presets or manually instead.
|
||||
---
|
||||
docs/grub-boot-indeterminate.service | 3 +++
|
||||
docs/grub-boot-success.timer | 3 +++
|
||||
util/systemd/grub-systemd-integration.service.in | 3 +++
|
||||
3 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service
|
||||
index 6c8dcb186b63..5bcb474a3d31 100644
|
||||
--- a/docs/grub-boot-indeterminate.service
|
||||
+++ b/docs/grub-boot-indeterminate.service
|
||||
@@ -9,3 +9,6 @@ Before=system-update-pre.target
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/grub2-editenv - incr boot_indeterminate
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=system-update.target
|
||||
diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer
|
||||
index 406f17200560..1d124cccc146 100644
|
||||
--- a/docs/grub-boot-success.timer
|
||||
+++ b/docs/grub-boot-success.timer
|
||||
@@ -5,3 +5,6 @@ ConditionVirtualization=!container
|
||||
|
||||
[Timer]
|
||||
OnActiveSec=2min
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=timers.target
|
||||
diff --git a/util/systemd/grub-systemd-integration.service.in b/util/systemd/grub-systemd-integration.service.in
|
||||
index c81fb594ce17..22ca1ca4885e 100644
|
||||
--- a/util/systemd/grub-systemd-integration.service.in
|
||||
+++ b/util/systemd/grub-systemd-integration.service.in
|
||||
@@ -6,3 +6,6 @@ ConditionPathExists=/run/systemd/reboot-to-boot-loader-menu
|
||||
|
||||
[Service]
|
||||
ExecStart=@libexecdir@/@grubdirname@/systemd-integration.sh
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=reboot.target
|
|
@ -332,3 +332,4 @@ Patch0331: 0331-grub_dl_load_segments-page-align-the-tramp-GOT-areas.patch
|
|||
Patch0332: 0332-emu-Add-switch-root-to-grub-emu.patch
|
||||
Patch0333: 0333-util-Enable-default-kernel-for-updates.patch
|
||||
Patch0334: 0334-efi-http-change-uint32_t-to-uintn_t.patch
|
||||
Patch0335: 0335-Add-Install-section-to-aux-systemd-units.patch
|
||||
|
|
38
grub2.spec
38
grub2.spec
|
@ -17,7 +17,7 @@
|
|||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.06
|
||||
Release: 98%{?dist}
|
||||
Release: 99%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
|
@ -62,8 +62,8 @@ BuildRequires: squashfs-tools
|
|||
BuildRequires: texinfo
|
||||
BuildRequires: xz-devel
|
||||
|
||||
# For %%_userunitdir macro
|
||||
BuildRequires: systemd
|
||||
# For %%_userunitdir and %%systemd_* macros
|
||||
BuildRequires: systemd-rpm-macros
|
||||
|
||||
%ifarch %{efi_arch}
|
||||
BuildRequires: pesign >= 0.99-8
|
||||
|
@ -114,6 +114,7 @@ Requires: gettext-runtime os-prober file
|
|||
Requires(pre): dracut
|
||||
Requires(pre): grep
|
||||
Requires(pre): sed
|
||||
%{?systemd_requires}
|
||||
|
||||
%description tools
|
||||
%{desc}
|
||||
|
@ -271,17 +272,8 @@ install -d -m 0755 %{buildroot}%{_sysconfdir}/kernel/install.d/
|
|||
# Install systemd user service to set the boot_success flag
|
||||
install -D -m 0755 -t %{buildroot}%{_userunitdir} \
|
||||
docs/grub-boot-success.{timer,service}
|
||||
install -d -m 0755 %{buildroot}%{_userunitdir}/timers.target.wants
|
||||
ln -s ../grub-boot-success.timer \
|
||||
%{buildroot}%{_userunitdir}/timers.target.wants
|
||||
# Install systemd system-update unit to set boot_indeterminate for offline-upd
|
||||
install -D -m 0755 -t %{buildroot}%{_unitdir} docs/grub-boot-indeterminate.service
|
||||
install -d -m 0755 %{buildroot}%{_unitdir}/system-update.target.wants
|
||||
install -d -m 0755 %{buildroot}%{_unitdir}/reboot.target.wants
|
||||
ln -s ../grub-boot-indeterminate.service \
|
||||
%{buildroot}%{_unitdir}/system-update.target.wants
|
||||
ln -s ../grub2-systemd-integration.service \
|
||||
%{buildroot}%{_unitdir}/reboot.target.wants
|
||||
|
||||
# Don't run debuginfo on all the grub modules and whatnot; it just
|
||||
# rejects them, complains, and slows down extraction.
|
||||
|
@ -332,6 +324,21 @@ elif [ -f /etc/grub.d/01_users ] && \
|
|||
fi
|
||||
fi
|
||||
|
||||
%post tools
|
||||
%systemd_post grub-boot-indeterminate.service
|
||||
%systemd_post grub-systemd-integration.service
|
||||
%systemd_user_post grub-boot-success.timer
|
||||
|
||||
%preun tools
|
||||
%systemd_preun grub-boot-indeterminate.service
|
||||
%systemd_preun grub-systemd-integration.service
|
||||
%systemd_user_preun grub-boot-success.timer
|
||||
|
||||
%postun tools
|
||||
%systemd_postun_with_restart grub-boot-indeterminate.service
|
||||
%systemd_postun_with_restart grub-systemd-integration.service
|
||||
%systemd_user_postun_with_restart grub-boot-success.timer
|
||||
|
||||
%posttrans common
|
||||
set -eu
|
||||
|
||||
|
@ -427,11 +434,8 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
|
|||
%{_sysconfdir}/grub.d/README
|
||||
%{_userunitdir}/grub-boot-success.timer
|
||||
%{_userunitdir}/grub-boot-success.service
|
||||
%{_userunitdir}/timers.target.wants
|
||||
%{_unitdir}/grub-boot-indeterminate.service
|
||||
%{_unitdir}/system-update.target.wants
|
||||
%{_unitdir}/grub2-systemd-integration.service
|
||||
%{_unitdir}/reboot.target.wants
|
||||
%{_unitdir}/systemd-logind.service.d
|
||||
%{_infodir}/grub2*
|
||||
%{_datarootdir}/grub/*
|
||||
|
@ -544,6 +548,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Sep 01 2023 Christian Glombek <cglombek@redhat.com> - 2.06-99
|
||||
- spec: Use systemd presets and macros for units in tools package
|
||||
- Resolves: #2230575
|
||||
|
||||
* Thu Aug 31 2023 Nicolas Frayer <nfrayer@redhat.com> - 2.06-98
|
||||
- spec: Modified posttrans to harden grub config detection
|
||||
- Resolves: #2235692
|
||||
|
|
Loading…
Reference in a new issue