diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9d6c956..7902148a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,8 +46,6 @@ jobs: baseImage: eclipse-temurin:25-jre-noble platforms: linux/amd64,linux/arm64,linux/riscv64 mcVersion: latest - # forked build that include riscv64 - knockdRepoOrg: Opvolger/knock - variant: java25-alpine baseImage: eclipse-temurin:25-jre-alpine platforms: linux/amd64,linux/arm64 diff --git a/build/alpine/install-packages.sh b/build/alpine/install-packages.sh index 633bdc1c..60d69c3f 100755 --- a/build/alpine/install-packages.sh +++ b/build/alpine/install-packages.sh @@ -3,6 +3,13 @@ set -e set -o pipefail +# Patched knockd is only available for amd64 on Alpine, so install the package for other architectures +knockPkg="" +if [ "$TARGETARCH" != amd64 ]; then + knockPkg="knock" + echo "Installing knock package for $TARGETARCH architecture" +fi + # Install necessary packages # shellcheck disable=SC2086 apk add --no-cache -U \ @@ -36,13 +43,18 @@ apk add --no-cache -U \ numactl \ jattach \ gcompat \ + "$knockPkg" \ ${EXTRA_ALPINE_PACKAGES} -# Download and install patched knockd -curl -fsSL -o /tmp/knock.tar.gz "https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-alpine-amd64.tar.gz" -tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz -ln -s /usr/local/sbin/knockd /usr/sbin/knockd -setcap cap_net_raw=ep /usr/local/sbin/knockd +if ! [ "$knockPkg" ]; then + # Download and install patched knockd + knockdUrl="https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-alpine-amd64.tar.gz" + echo "Downloading knockd from $knockdUrl" + curl -fsSL -o /tmp/knock.tar.gz "$knockdUrl" + tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz + ln -s /usr/local/sbin/knockd /usr/sbin/knockd + setcap cap_net_raw=ep /usr/local/sbin/knockd +fi # Set Git credentials globally cat <> /etc/gitconfig diff --git a/build/ubuntu/install-packages.sh b/build/ubuntu/install-packages.sh index 2744f9ff..81997a37 100755 --- a/build/ubuntu/install-packages.sh +++ b/build/ubuntu/install-packages.sh @@ -37,8 +37,13 @@ apt-get install -y \ # Clean up APT when done apt-get clean +if [ "$TARGETARCH" = riscv64 ]; then + KNOCKD_REPO_ORG=Opvolger/knock +fi # Download and install patched knockd -curl -fsSL -o /tmp/knock.tar.gz "https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-$TARGET.tar.gz" +knockdUrl="https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-$TARGET.tar.gz" +echo "Downloading knockd from $knockdUrl" +curl -fsSL -o /tmp/knock.tar.gz "$knockdUrl" tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz ln -s /usr/local/sbin/knockd /usr/sbin/knockd setcap cap_net_raw=ep /usr/local/sbin/knockd