From 6ff896bbb6a6f272e5ea31cbe10b14a0bae9fd0f Mon Sep 17 00:00:00 2001
From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Date: Sat, 5 Jun 2021 22:29:32 +0200
Subject: [PATCH 1/2] Add fai-server package helper

The sources.list has been extracted from a Trisquel livecd and
a whitespace issue was fixed along the way.

BugLink: https://trisquel.info/en/issues/28007
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
---
 helpers/DATA/fai-server/sources.list | 13 +++++++++++
 helpers/make-fai-server              | 33 ++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 helpers/DATA/fai-server/sources.list
 create mode 100644 helpers/make-fai-server

diff --git a/helpers/DATA/fai-server/sources.list b/helpers/DATA/fai-server/sources.list
new file mode 100644
index 00000000..5b5bf6c0
--- /dev/null
+++ b/helpers/DATA/fai-server/sources.list
@@ -0,0 +1,13 @@
+# Trisquel repositories for supported software and updates
+
+deb https://archive.trisquel.info/trisquel etiona main
+#deb-src https://archive.trisquel.info/trisquel etiona main
+
+deb https://archive.trisquel.info/trisquel etiona-updates main
+#deb-src https://archive.trisquel.info/trisquel etiona-updates main
+
+deb https://archive.trisquel.info/trisquel etiona-security main
+#deb-src https://archive.trisquel.info/trisquel etiona-security main
+
+#deb https://archive.trisquel.info/trisquel etiona-backports main
+#deb-src https://archive.trisquel.info/trisquel etiona-backports main
diff --git a/helpers/make-fai-server b/helpers/make-fai-server
new file mode 100644
index 00000000..770e6fcd
--- /dev/null
+++ b/helpers/make-fai-server
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+#    Copyright (C) 2021 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.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
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+#
+
+VERSION=1
+
+. ./config
+
+cp $DATA/sources.list conf/sources.list
+
+sed 's#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP="etiona http://archive.trisquel.info/trisquel"#' \
+    -i conf/nfsroot.conf
+
+sed 's/linux-image-server/linux-image-generic/g' -i conf/NFSROOT
+
+changelog "Replace Ubuntu sources.list, packages repository url and specific packages by Trisquel's"
+
+compile
-- 
GitLab


From cce10ed39be812879e6ac118dbd7fb12e28575c4 Mon Sep 17 00:00:00 2001
From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Date: Tue, 24 Aug 2021 19:02:18 +0200
Subject: [PATCH 2/2] Fix proguard runtime with java pointing to Java 8

Trisquel 9 has at least two java runtimes: java-8-openjdk and
java-11-openjdk.

When configuring update-alternatives to use java-8-openjdk, we
have the following error when running 'proguard':
    Error: A JNI error has occurred, please check your installation
    and try again
    Exception in thread "main" java.lang.UnsupportedClassVersionError:
    proguard/ProGuard has been compiled by a more recent version of
    the Java Runtime (class file version 53.0), this version of the
    Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

This problem isn't theorical as we need Java 8 to build Replicant 6.0
under Trisquel 9, but we also need proguard to work.

This happens because of the combination of two things:
- /usr/bin/proguard has the following content:
      #!/bin/sh

      exec java -Xss300000 -jar /usr/share/java/proguard.jar "$@"
  So it uses the Java selected by update-alternatives, which could be
  java-8-openjdk.
- The debian/control file uses the default-jdk package to build
  proguard, so it probably build it for newer Java runtimes.
  Changing the java versions in debian/control isn't sufficient to
  make it work with Java 8.

The solution we chose here is to make sure that it uses Java 11
when running. This way we don't need to modify extensively the
package and we end up with less risk of breakages.

BugLink: https://trisquel.info/en/issues/28177
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
---
 helpers/make-proguard | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 helpers/make-proguard

diff --git a/helpers/make-proguard b/helpers/make-proguard
new file mode 100644
index 00000000..8b7c66f7
--- /dev/null
+++ b/helpers/make-proguard
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+#    Copyright (C) 2021 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.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
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+#
+
+VERSION=1
+
+. ./config
+
+sed \
+    's#^exec java #exec /usr/lib/jvm/java-11-openjdk-amd64/bin/java #' \
+    -i ./debian/scripts/proguard
+
+sed 's/default-jre/openjdk-11-jre/g' -i debian/control
+
+changelog "Always use Java 11 because Trisquel 9 also has Java 8 which can't run classes compiled by Java 11"
+
+compile
-- 
GitLab