From 6bd3005b955bf770cb51e11c89e5282091d43ea2 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 31 Oct 2025 11:10:47 +0100 Subject: [PATCH] apk vs apt --- .gitea/workflows/test.yml | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 733fc45..9b64eab 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -102,36 +102,36 @@ jobs: shell: bash run: | set -e - - # Check if apt-get exists; if not, install it - if ! command -v apt-get &> /dev/null; then - echo "apt-get not found. Attempting to install..." - if command -v apk &> /dev/null; then - echo "Using apk to install apt (Alpine detected)..." - apk update - apk add --no-cache apt - elif command -v dnf &> /dev/null; then - echo "Using dnf (Fedora/RHEL detected)..." - dnf install -y apt - elif command -v yum &> /dev/null; then - echo "Using yum (CentOS/RHEL detected)..." - yum install -y apt - else - echo "No supported package manager found!" - exit 1 - fi + + # Detect package manager + if command -v apt-get &> /dev/null; then + echo "Debian/Ubuntu detected, using apt-get..." + apt-get update -qq + apt-get install -y -qq wget curl ca-certificates gnupg software-properties-common + wget -q https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb + apt install -y -qq ./jdk-21_linux-x64_bin.deb + + elif command -v apk &> /dev/null; then + echo "Alpine detected, using apk..." + apk update >/dev/null + apk add --no-cache openjdk21 wget curl ca-certificates >/dev/null + + elif command -v yum &> /dev/null; then + echo "RHEL/CentOS detected, using yum..." + yum install -y -q wget curl ca-certificates gnupg2 >/dev/null + + elif command -v dnf &> /dev/null; then + echo "Fedora detected, using dnf..." + dnf install -y -q wget curl ca-certificates gnupg2 >/dev/null + + else + echo "No supported package manager found!" + exit 1 fi - - # Continue installation using apt-get - apt-get update -y - apt-get install -y apt-transport-https ca-certificates curl gnupg wget software-properties-common - - # Download and install Oracle JDK 21 - wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb - apt install -y ./jdk-21_linux-x64_bin.deb - + # Verify installation java -version + - name: Set up Java 21 and Maven run: |