From 0ba61bb5903a22044decaa9390437e83be0dadd7 Mon Sep 17 00:00:00 2001
From: txtsd <thexerothermicsclerodermoid@gmail.com>
Date: Tue, 8 Feb 2022 08:55:52 +0530
Subject: Implement even more PR suggestions

---
 .github/scripts/prepare_JREs.sh | 38 +++++++++++++++-----------------------
 .github/workflows/build.yml     |  2 +-
 2 files changed, 16 insertions(+), 24 deletions(-)

(limited to '.github')

diff --git a/.github/scripts/prepare_JREs.sh b/.github/scripts/prepare_JREs.sh
index 1525fdb9..b85e9c2f 100755
--- a/.github/scripts/prepare_JREs.sh
+++ b/.github/scripts/prepare_JREs.sh
@@ -13,33 +13,25 @@ for file in *;
 do
     mkdir temp
 
-    # Handle OpenJDK17 archive
-    re='(OpenJDK17U-jre_x64_linux_hotspot_17.(.*).tar.gz)'
+    re='(OpenJDK([[:digit:]]+)U-jre_x64_linux_hotspot_([[:digit:]]+)(.*).tar.gz)'
     if [[ $file =~ $re ]];
     then
-        version=${BASH_REMATCH[2]}
-        version_edit=$(echo $version | sed -e 's/_/+/g')
-        dir_name=jdk-17.$version_edit-jre
-        echo $dir_name
-        mkdir jre17
+        version_major=${BASH_REMATCH[2]}
+        version_trailing=${BASH_REMATCH[4]}
+
+        if [ $version_major = 17 ];
+        then
+            hyphen='-'
+        else
+            hyphen=''
+        fi
+
+        version_edit=$(echo $version_trailing | sed -e 's/_/+/g' | sed -e 's/b/-b/g')
+        dir_name=jdk$hyphen$version_major$version_edit-jre
+        mkdir jre$version_major
         tar -xzf $file -C temp
         pushd temp/$dir_name
-        cp -r . ../../jre17
-        popd
-
-    fi
-
-    # Handle OpenJDK8 archive
-    re='(OpenJDK8U-jre_x64_linux_hotspot_8(.*).tar.gz)'
-    if [[ $file =~ $re ]];
-    then
-        version=${BASH_REMATCH[2]}
-        version_edit=$(echo $version | sed -e 's/b/-b/g')
-        dir_name=jdk8$version_edit-jre
-        mkdir jre8
-        tar -xzf $file -C temp
-        pushd temp/$dir_name
-        cp -r . ../../jre8
+        cp -r . ../../jre$version_major
         popd
     fi
 
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 600831c0..42661b09 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -124,7 +124,7 @@ jobs:
           LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk/lib/server"
           LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk/lib"
 
-          ./linuxdeploy-x86_64.AppImage --appdir ${{ env.INSTALL_DIR }} --output appimage --plugin qt -d ${{ env.INSTALL_DIR }}/usr/share/applications/org.polymc.polymc.desktop -i ${{ env.INSTALL_DIR }}/usr/share/icons/hicolor/scalable/apps/org.polymc.PolyMC.svg
+          ./linuxdeploy-x86_64.AppImage --appdir ${{ env.INSTALL_DIR }} --output appimage --plugin qt -i ${{ env.INSTALL_DIR }}/usr/share/icons/hicolor/scalable/apps/org.polymc.PolyMC.svg
 
       - name: Run windeployqt
         if: runner.os == 'Windows'
-- 
cgit