From e34f4e907eb3805665f7a77a2b3aa1e4094e3b1c Mon Sep 17 00:00:00 2001
From: Pavel Vondruska <dexter.cz@gmail.com>
Date: Wed, 31 Aug 2022 14:39:22 +0200
Subject: [PATCH] odhadnuti vsech existujicich jader a build modulu pro vsechny

---
 make.sh | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/make.sh b/make.sh
index 6499a7a..e097380 100755
--- a/make.sh
+++ b/make.sh
@@ -24,13 +24,16 @@ deb-src http://ftp.zcu.cz/pub/linux/debian ${VERSION_CODENAME}-updates main cont
 deb-src http://ftp.zcu.cz/pub/linux/debian-security $(get_debian_security) main contrib non-free
 EOSOURCES
 
-# Instalace buildovacich veci a zavislosti
-apt update -qqq
-apt install -yqqq git devscripts build-essential linux-image-amd64 linux-headers-amd64 module-assistant
+#echo 'deb [trusted=yes] https://repo.metacentrum.cz/ ${VERSION_CODENAME} main pilot' >> /etc/apt/sources.list
 
-echo 'deb [trusted=yes] https://repo.metacentrum.cz/ bullseye main pilot' >> /etc/apt/sources.list
+PACKAGES="linux-image-amd64 linux-headers-amd64"
+if [ "${VERSION_ID}" -eq "11" ]; then
+    PACKAGES="$(apt search linux-headers-5.10.0- 2>/dev/null | grep -Po "linux-headers-\K\d+\.\d+\.\d+\-\d+\-amd64" | sort -u | while read v; do echo "linux-image-$v linux-headers-$v"; done | paste -s -d ' ')"
+fi
+
+# Instalace buildovacich veci a zavislosti
 apt update -qqq
-apt install -yqqq linux-headers-5.10.0-13-amd64 linux-image-5.10.0-13-amd64-unsigned
+apt install -yqqq git devscripts build-essential module-assistant ${PACKAGES}
 
 m-a -l $(dpkg -l | grep -Po "linux-image-\K\d+.*\-amd64" | paste -s -d ',') a-b openafs > /dev/null 2>&1
 
-- 
GitLab