From 99adacd20e903bea65155c9233341ac090ec3b5c Mon Sep 17 00:00:00 2001
From: Pavel Vondruska <dexter.cz@gmail.com>
Date: Thu, 26 Jan 2023 10:42:00 +0100
Subject: [PATCH] Added metapackages linux-image-amd64-meta with right
 dependencies

---
 make.sh  |  6 ++++++
 make_pkg | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100755 make_pkg

diff --git a/make.sh b/make.sh
index 3c1ded6..263bf25 100755
--- a/make.sh
+++ b/make.sh
@@ -56,6 +56,12 @@ cd ..
 dch -l "+zs" "MetaCentrum patches"
 for i in `ls debian/patches/meta`; do dch -a "$i"; done
 
+VER_PKG=$(head -1 debian/changelog | grep -Po "\d[^\)]+")
+VER_KER=$(ls debian/linux-headers-*-cloud-amd64.postinst | grep -Po "\d.+(?=-cloud)")
+cd ..
+./make_pkg ${VER_PKG} ${VER_KER}
+cd ${LINDIR}
+
 mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --yes' debian/control
 
 # Build balicku (poprve skonci hned chybou)
diff --git a/make_pkg b/make_pkg
new file mode 100755
index 0000000..5e38988
--- /dev/null
+++ b/make_pkg
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+VER_PKG=$1
+VER_KER=$2
+
+echo $VER_PKG
+echo $VER_KER
+
+rm -rf kernel headers
+mkdir -p {kernel,headers}/DEBIAN
+
+cat > kernel/DEBIAN/control <<EOF
+Package: linux-image-amd64-meta
+Version: ${VER_PKG}
+Architecture: amd64
+Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org>
+Installed-Size: 13
+Depends: linux-image-${VER_KER}-amd64-unsigned (= ${VER_PKG})
+Section: kernel
+Priority: optional
+Homepage: https://www.kernel.org/
+Description: Linux for 64-bit PCs (meta-package)
+ This package depends on the latest Linux kernel and modules for use on PCs
+ with AMD64, Intel 64 or VIA Nano processors.
+EOF
+
+cat > headers/DEBIAN/control <<EOF
+Package: linux-headers-amd64-meta
+Version: ${VER_PKG}
+Architecture: amd64
+Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org>
+Installed-Size: 10
+Depends: linux-headers-${VER_KER}-amd64 (= ${VER_PKG})
+Section: kernel
+Priority: optional
+Homepage: https://www.kernel.org/
+Description: Header files for Linux amd64 configuration (meta-package)
+ This package depends on the architecture-specific header files for the
+ latest Linux kernel amd64 configuration.
+EOF
+
+dpkg-deb -b kernel linux-image-amd64-meta.deb
+dpkg-deb -b headers linux-headers-amd64-meta.deb
-- 
GitLab