From 5f284f142f1fad99fdece111081f6f6f45c80ae1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luis=20Guzm=C3=A1n?= <ark@switnet.org>
Date: Fri, 30 Jul 2021 17:58:02 +0000
Subject: [PATCH] Add mode to check for current release kernel

Also add trisquel's B138CA450C05112F key
---
 helpers/config                |  1 +
 helpers/make-debian-installer | 41 +++++++++++++++++++++++------------
 2 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/helpers/config b/helpers/config
index c09000f01..bd18aa217 100755
--- a/helpers/config
+++ b/helpers/config
@@ -101,6 +101,7 @@ cp trusted.local.gpg "${LOCAL_APT}/etc/trusted.gpg"
 else
 # Trisquel key
 apt-key --keyring ${LOCAL_APT}/etc/trusted.gpg adv --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys B4EFB9F38D8AEBF1 > /dev/null
+apt-key --keyring ${LOCAL_APT}/etc/trusted.gpg adv --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys B138CA450C05112F > /dev/null
 # Ubuntu gpg keys
 apt-key --keyring ${LOCAL_APT}/etc/trusted.gpg adv --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys 40976EAF437D05B5 > /dev/null
 apt-key --keyring ${LOCAL_APT}/etc/trusted.gpg adv --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys 3B4FE6ACC0B21F32 > /dev/null
diff --git a/helpers/make-debian-installer b/helpers/make-debian-installer
index ac87af485..1bc56f756 100644
--- a/helpers/make-debian-installer
+++ b/helpers/make-debian-installer
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
 #    Copyright (C) 2009-2020 Ruben Rodriguez <ruben@trisquel.info>
+#    Copyright (C) 2021 Luis Guzman <ark@switnet.org>
 #
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
@@ -17,15 +18,33 @@
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 #
 
-VERSION=8
+VERSION=9
 NETINST=true
+
 . ./config
 
-find build/pkg-lists -type f | xargs sed -i /media-retriever/d
+cat << EOF > ${LOCAL_APT}/etc/apt_${CODENAME}.conf
+Dir::State "${LOCAL_APT}/var/lib/apt";
+Dir::State::status "${LOCAL_APT}/var/lib/dpkg/status";
+Dir::Etc::SourceList "${LOCAL_APT}/etc/apt.sources_${CODENAME}.list";
+Dir::Etc::SourceParts "";
+Dir::Cache "${LOCAL_APT}/var/cache/apt";
+pkgCacheGen::Essential "none";
+Dir::Etc::Trusted "${LOCAL_APT}/etc/trusted.gpg";
+Acquire::ForceIPv4 "true";
+EOF
 
-LASTKERNEL=$(apt-cache show linux-libc-dev|grep ^Version |head -n1|cut -d" " -f2|cut -d. -f1,2,3)
-/bin/sed -i "s/^BASEVERSION.*/BASEVERSION = $LASTKERNEL/g" ./build/config/i386.cfg ./build/config/amd64.cfg
-sed -i "s/^MEDIUM_SUPPORTED.*/MEDIUM_SUPPORTED = cdrom netboot/g" ./build/config/i386.cfg ./build/config/amd64.cfg
+cat << EOF > ${LOCAL_APT}/etc/apt.sources_${CODENAME}.list
+deb $LOCALMIRROR $CODENAME main
+deb $LOCALMIRROR $CODENAME-updates main
+deb $LOCALMIRROR $CODENAME-security main
+EOF
+
+find build/pkg-lists -type f | xargs sed -i /media-retriever/d
+apt-get update -c ${LOCAL_APT}/etc/apt_${CODENAME}.conf
+LASTKERNEL=$(apt-cache show -c ${LOCAL_APT}/etc/apt_${CODENAME}.conf linux-libc-dev|grep ^Version |head -n1|cut -d" " -f2|cut -d. -f1,2,3)
+sed -i "s/^BASEVERSION.*/BASEVERSION = $LASTKERNEL/g" ./build/config/amd64.cfg
+sed -i "s/^MEDIUM_SUPPORTED.*/MEDIUM_SUPPORTED = cdrom netboot/g" ./build/config/amd64.cfg
 
 sed -i 's/shim-signed/shim/g' debian/control
 
@@ -38,19 +57,13 @@ deb $LOCALMIRROR $CODENAME-updates main/debian-installer
 #deb $LOCALMIRROR $CODENAME-security main/debian-installer
 EOF
 
+#firmware-linux-free-udeb is missing
 cat << EOF >> build/pkg-lists/netboot/common
-firmware-carl9170-udeb
 open-ath9k-htc-firmware-udeb
 openfwwf-udeb
 EOF
 
-rpl 2004-2013 2004-2018 . -R
-rpl 2004-2012 2004-2018 . -R
-rpl 2004-2011 2004-2018 . -R
-rpl 2004-2010 2004-2018 . -R
-rpl 2004-2009 2004-2018 . -R
-rpl 2004-2008 2004-2018 . -R
-rpl 2004-2007 2004-2018 . -R
+replace "2004-20.." "2004-20$(date +'%y')" . -R
 rpl www.ubuntu.com trisquel.info . -R
 rpl ubuntu.com trisquel.info build/boot/ -R
 rpl www.ubuntu trisquel build/boot/ -R
@@ -59,7 +72,7 @@ rpl Ubuntu Trisquel . -R
 rpl UBUNTU TRISQUEL . -R
 rpl TRISQUEL-PT UBUNTU-PT . -R
 rpl Canonical Trisquel . -R
-rpl Ltd\. GNU/Linux . -R 
+rpl Ltd\. GNU/Linux . -R
 rpl Trisquel-l10n ubuntu-l10n . -R
 rpl "Trisquel Ltd, and Rosetta" "Canonical Ltd, and Rosetta" . -R
 rpl ubuntu-keyring trisquel-keyring . -R
-- 
GitLab