From ddb9b1b93df3bf75843ab952534a39a7e8dd7711 Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Sat, 22 Jul 2023 10:41:11 +0200 Subject: [PATCH 4/5] Install scripts and service files for keeping the surface kernel the default Signed-off-by: Dorian Stoll --- redhat/kernel.spec.template | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index 890d9225edd8..68b06ba0d4b1 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -992,6 +992,11 @@ Source4000: README.rst Source4001: rpminspect.yaml Source4002: gating.yaml +Source4100: linux-surface-default-watchdog.path +Source4101: linux-surface-default-watchdog.service +Source4102: linux-surface-default-watchdog.py +Source4103: 90-linux-surface-default-watchdog.preset + ## Patches needed for building this package %if !%{nopatches} @@ -1025,6 +1030,7 @@ Requires(pre): %{initrd_prereq}\ Requires(pre): ((linux-firmware >= 20150904-56.git6ebf5d57) if linux-firmware)\ Recommends: linux-firmware\ Recommends: iptsd\ +Recommends: %{package_name}-default-watchdog\ Requires(preun): systemd >= 200\ Conflicts: xfsprogs < 4.3.0-1\ Conflicts: xorg-x11-drv-vmmouse < 13.0.99\ @@ -1039,6 +1045,13 @@ AutoProv: yes\ %{nil} +%package default-watchdog +Summary: Watchdog service ensuring that the surface kernel stays the default kernel. +%description default-watchdog +This package provides a systemd service that will automatically keep +the surface kernel as the default kernel in GRUB, even if a newer stock +kernel has been installed. + %package doc Summary: Various documentation bits found in the kernel source Group: Documentation @@ -3170,6 +3183,11 @@ find Documentation -type d | xargs chmod u+w cd linux-%{KVERREL} +install -D -m644 "%{SOURCE4100}" -t "%{buildroot}%{_unitdir}" +install -D -m644 "%{SOURCE4101}" -t "%{buildroot}%{_unitdir}" +install -D -m755 "%{SOURCE4102}" -t "%{buildroot}%{_bindir}" +install -D -m755 "%{SOURCE4103}" -t "%{buildroot}%{_presetdir}" + # re-define RPM_VMLINUX_H, because it doesn't carry over from %build RPM_VMLINUX_H="$(cat ../vmlinux_h_path)" @@ -3441,6 +3459,15 @@ popd ### scripts ### +%post default-watchdog +%systemd_post linux-surface-default-watchdog.path + +%preun default-watchdog +%systemd_preun linux-surface-default-watchdog.path + +%postun default-watchdog +%systemd_postun_with_restart linux-surface-default-watchdog.path + %if %{with_tools} %post -n %{package_name}-tools-libs /sbin/ldconfig @@ -3904,6 +3931,12 @@ fi\ %{_libexecdir}/kselftests %endif +%files default-watchdog +%{_bindir}/linux-surface-default-watchdog.py +%{_unitdir}/linux-surface-default-watchdog.path +%{_unitdir}/linux-surface-default-watchdog.service +%{_presetdir}/90-linux-surface-default-watchdog.preset + # empty meta-package %if %{with_up_base} %ifnarch %nobuildarches noarch -- 2.46.0