2023-07-22 08:46:38 +00:00
|
|
|
From 81141a454f41cbc5fd41b778f85b10552c8676e8 Mon Sep 17 00:00:00 2001
|
2023-06-03 09:49:16 +00:00
|
|
|
From: Dorian Stoll <dorian.stoll@tmsp.io>
|
2023-07-22 08:46:38 +00:00
|
|
|
Date: Sat, 22 Jul 2023 10:41:11 +0200
|
2023-06-03 09:49:16 +00:00
|
|
|
Subject: [PATCH] Install scripts and service files for keeping the surface
|
|
|
|
kernel the default
|
|
|
|
|
|
|
|
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
|
|
|
|
---
|
2023-06-15 21:05:39 +00:00
|
|
|
redhat/kernel.spec.template | 34 ++++++++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 34 insertions(+)
|
2023-06-03 09:49:16 +00:00
|
|
|
|
|
|
|
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
|
2023-07-22 08:46:38 +00:00
|
|
|
index 43dce82a9d36..28df94e561d4 100644
|
2023-06-03 09:49:16 +00:00
|
|
|
--- a/redhat/kernel.spec.template
|
|
|
|
+++ b/redhat/kernel.spec.template
|
2023-07-22 08:46:38 +00:00
|
|
|
@@ -1025,6 +1025,11 @@ Source4000: README.rst
|
2023-06-03 09:49:16 +00:00
|
|
|
Source4001: rpminspect.yaml
|
|
|
|
Source4002: gating.yaml
|
|
|
|
|
2023-06-15 21:05:39 +00:00
|
|
|
+Source4100: linux-surface-default-watchdog.path
|
|
|
|
+Source4101: linux-surface-default-watchdog.service
|
pkg: fedora: Update kernel-watchdog service
It seems that I just can't stop finding weird btrfs setups that break
the current script.
When you use btrfs with a default subvolume, GRUB will use normal paths,
like on ext4. So instead of /@/boot/vmlinuz you have /boot/vmlinuz.
The issue is that grub2-mkrelpath doesn't know about that. The script
would have to parse the GRUB configuration and fstab, to figure out
if btrfs is used with a default subvolume, and then add a flag to the
command depending on that.
However, instead of adding yet another workaround, let's just forget
about grubby and do what we want to do ourselves. Because, as it turns
out, not taking a weird detour over the path that GRUB uses to load the
kernel makes everything much easier.
Since this means that we are dealing with even more filepath and string
mangling, I decided to rewrite the script in python. It would work fine
in bash, but it would be even more spaghetti code that I don't really
want to write. And python is always available in Fedora anyway,
because DNF is written in it.
2024-02-06 21:49:49 +00:00
|
|
|
+Source4102: linux-surface-default-watchdog.py
|
2023-06-15 21:05:39 +00:00
|
|
|
+Source4103: 90-linux-surface-default-watchdog.preset
|
2023-06-03 09:49:16 +00:00
|
|
|
+
|
|
|
|
## Patches needed for building this package
|
|
|
|
|
|
|
|
%if !%{nopatches}
|
2023-07-22 08:46:38 +00:00
|
|
|
@@ -1058,6 +1063,7 @@ Requires(pre): %{initrd_prereq}\
|
2023-06-15 21:05:39 +00:00
|
|
|
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\
|
2023-07-22 08:46:38 +00:00
|
|
|
@@ -1072,6 +1078,14 @@ AutoProv: yes\
|
2023-06-15 21:05:39 +00:00
|
|
|
%{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
|
2023-07-22 08:46:38 +00:00
|
|
|
@@ -2945,6 +2959,11 @@ find Documentation -type d | xargs chmod u+w
|
2023-06-03 09:49:16 +00:00
|
|
|
|
|
|
|
cd linux-%{KVERREL}
|
|
|
|
|
|
|
|
+install -D -m644 "%{SOURCE4100}" -t "%{buildroot}%{_unitdir}"
|
|
|
|
+install -D -m644 "%{SOURCE4101}" -t "%{buildroot}%{_unitdir}"
|
|
|
|
+install -D -m755 "%{SOURCE4102}" -t "%{buildroot}%{_bindir}"
|
2023-06-15 21:05:39 +00:00
|
|
|
+install -D -m755 "%{SOURCE4103}" -t "%{buildroot}%{_presetdir}"
|
2023-06-03 09:49:16 +00:00
|
|
|
+
|
|
|
|
%if %{with_doc}
|
|
|
|
docdir=$RPM_BUILD_ROOT%{_datadir}/doc/kernel-doc-%{specversion}-%{pkgrelease}
|
|
|
|
|
2023-07-22 08:46:38 +00:00
|
|
|
@@ -3197,6 +3216,15 @@ popd
|
2023-06-15 21:05:39 +00:00
|
|
|
### 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
|
2023-07-22 08:46:38 +00:00
|
|
|
@@ -3609,6 +3637,12 @@ fi\
|
2023-06-15 21:05:39 +00:00
|
|
|
%{_libexecdir}/kselftests
|
|
|
|
%endif
|
|
|
|
|
|
|
|
+%files default-watchdog
|
pkg: fedora: Update kernel-watchdog service
It seems that I just can't stop finding weird btrfs setups that break
the current script.
When you use btrfs with a default subvolume, GRUB will use normal paths,
like on ext4. So instead of /@/boot/vmlinuz you have /boot/vmlinuz.
The issue is that grub2-mkrelpath doesn't know about that. The script
would have to parse the GRUB configuration and fstab, to figure out
if btrfs is used with a default subvolume, and then add a flag to the
command depending on that.
However, instead of adding yet another workaround, let's just forget
about grubby and do what we want to do ourselves. Because, as it turns
out, not taking a weird detour over the path that GRUB uses to load the
kernel makes everything much easier.
Since this means that we are dealing with even more filepath and string
mangling, I decided to rewrite the script in python. It would work fine
in bash, but it would be even more spaghetti code that I don't really
want to write. And python is always available in Fedora anyway,
because DNF is written in it.
2024-02-06 21:49:49 +00:00
|
|
|
+%{_bindir}/linux-surface-default-watchdog.py
|
2023-06-15 21:05:39 +00:00
|
|
|
+%{_unitdir}/linux-surface-default-watchdog.path
|
|
|
|
+%{_unitdir}/linux-surface-default-watchdog.service
|
|
|
|
+%{_presetdir}/90-linux-surface-default-watchdog.preset
|
|
|
|
+
|
|
|
|
# empty meta-package
|
2023-07-22 08:46:38 +00:00
|
|
|
%if %{with_up_base}
|
2023-06-15 21:05:39 +00:00
|
|
|
%ifnarch %nobuildarches noarch
|
2023-06-03 09:49:16 +00:00
|
|
|
--
|
2023-07-22 08:46:38 +00:00
|
|
|
2.41.0
|
2023-06-03 09:49:16 +00:00
|
|
|
|