From 99969329758076b65e1402f80035d19c7fbb89e6 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 22 Jun 2025 18:43:47 +1200 Subject: [PATCH] config: Update 4 files --- .gitea/workflows/BuildTestPublish.yaml | 2 -- getpkg/Dockerfile.dropshell-build | 8 ++++++ getpkg/publish.sh | 4 --- install_upx.sh | 40 -------------------------- 4 files changed, 8 insertions(+), 46 deletions(-) delete mode 100755 install_upx.sh diff --git a/.gitea/workflows/BuildTestPublish.yaml b/.gitea/workflows/BuildTestPublish.yaml index 432ee40..377ed3f 100644 --- a/.gitea/workflows/BuildTestPublish.yaml +++ b/.gitea/workflows/BuildTestPublish.yaml @@ -24,8 +24,6 @@ jobs: registry: gitea.jde.nz username: DoesntMatter password: ${{ secrets.DOCKER_PUSH_TOKEN }} - - name: install upx - run: ./install_upx.sh - name: Build Test Publish All run: | SOS_WRITE_TOKEN=${{ secrets.SOS_WRITE_TOKEN }} ./buildtestpublish_all.sh diff --git a/getpkg/Dockerfile.dropshell-build b/getpkg/Dockerfile.dropshell-build index 750c9bf..0c44468 100644 --- a/getpkg/Dockerfile.dropshell-build +++ b/getpkg/Dockerfile.dropshell-build @@ -7,6 +7,8 @@ ARG CMAKE_BUILD_TYPE=Debug # Set working directory WORKDIR /app +SHELL ["/bin/bash", "-c"] + # Create cache directories RUN mkdir -p /ccache @@ -62,6 +64,12 @@ RUN --mount=type=cache,target=/build \ find /build -type f -executable -name "*${PROJECT}*" -exec cp {} /output/${PROJECT} \; || \ find /build -type f -executable -exec cp {} /output/${PROJECT} \; + +# if we're a release build, then run upx on the binary. +RUN if [ "${CMAKE_BUILD_TYPE}" = "Release" ]; then \ + upx /output/${PROJECT}; \ + fi + # Final stage that only contains the binary FROM scratch AS project diff --git a/getpkg/publish.sh b/getpkg/publish.sh index fd8497d..146bcd9 100755 --- a/getpkg/publish.sh +++ b/getpkg/publish.sh @@ -45,10 +45,6 @@ docker build \ [ -f "${OUTPUT}/${PROJECT}" ] || die "Build failed." -# compact it! -command -v upx >/dev/null 2>&1 || die "upx not installed" -upx "${OUTPUT}/${PROJECT}" - #-------------------------------------------------------------------------------- SOS="${SCRIPT_DIR}/../sos/sos" [ -f "${SOS}" ] || die "Failed to find sos" diff --git a/install_upx.sh b/install_upx.sh deleted file mode 100755 index d461a09..0000000 --- a/install_upx.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# Determine architecture -ARCH=$(uname -m) -case $ARCH in - x86_64) - UPX_ARCH="amd64" - ;; - aarch64) - UPX_ARCH="arm64" - ;; - *) - echo "Unsupported architecture: $ARCH" - exit 1 - ;; -esac - -# Download and install UPX v5.0.1 -UPX_VERSION="5.0.1" -UPX_FILE="upx-${UPX_VERSION}-${UPX_ARCH}_linux.tar.xz" -UPX_URL="https://github.com/upx/upx/releases/download/v${UPX_VERSION}/${UPX_FILE}" - -echo "Downloading UPX ${UPX_VERSION} for ${UPX_ARCH}..." -curl -L -o "${UPX_FILE}" "${UPX_URL}" - -# Extract UPX -tar -xf "${UPX_FILE}" - -# Install to /usr/local/bin -sudo cp "upx-${UPX_VERSION}-${UPX_ARCH}_linux/upx" /usr/local/bin/ -sudo chmod +x /usr/local/bin/upx - -# Verify installation -upx --version - -# Cleanup -rm -rf "${UPX_FILE}" "upx-${UPX_VERSION}-${UPX_ARCH}_linux" - -echo "UPX ${UPX_VERSION} installed successfully!" \ No newline at end of file