PKGBUILDs/core/mkinitcpio/0002-functions-handle-gzip-compressed-kernels-in-kver_gen.patch
2024-05-14 15:45:14 +00:00

29 lines
903 B
Diff

From daf6a7db2a9c0fd20bf4b0ba6196bf5b0eed4b03 Mon Sep 17 00:00:00 2001
From: Janne Grunau <j@jannau.net>
Date: Sun, 30 Jan 2022 10:01:43 +0000
Subject: [PATCH 2/3] functions: handle gzip compressed kernels in kver_generic
Signed-off-by: Janne Grunau <j@jannau.net>
---
functions | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/functions b/functions
index 406278c..6816ab8 100755
--- a/functions
+++ b/functions
@@ -444,6 +444,11 @@ kver_generic() {
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/init/version-timestamp.c?h=v6.7#n28
read -r _ _ kver _ < <(decompress_cat "$1" | grep -m1 -aoE 'Linux version .(\.[-[:alnum:]+]+)+')
+ # try if the image is gzip compressed
+ if [[ -z "$kver" ]]; then
+ read _ _ kver _ < <(gzip -c -d "$1" | grep -m1 -aoE 'Linux version .(\.[-[:alnum:]]+)+')
+ fi
+
printf '%s' "$kver"
}
--
2.36.1