diff --git a/.gitattributes b/.gitattributes index ad353c6..1519a95 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,5 @@ *.png binary *.sfx binary *.zip binary +*.tar binary +*.gz binary diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a4e3b04..e9eac59 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,7 @@ test: script: - ./gradlew check -wrap-client: +exe-wrap: stage: wrap image: debian:stable-slim variables: @@ -52,3 +52,31 @@ wrap-client: paths: - ./sheepit-wrapper.exe expire_in: 1 week + +dmg-x64-wrap: + stage: wrap + image: debian:stable-slim + variables: + ARCH: "Intel-x64" + JRETAR: "OpenJDK11U-jre_x64_mac_hotspot_11.0.15_10.tar.gz" # Taken from https://adoptium.net/releases.html?variant=openjdk11&jvmVariant=hotspot + script: + - dmg-wrapper/ci-build-dmg.sh $ARCH $JRETAR + artifacts: + name: "$CI_COMMIT_REF_NAME-sheepit-artifact-$ARCH-dmg" + paths: + - ./dmg-wrapper/SheepIt-$ARCH.dmg + expire_in: 1 week + +dmg-arm-wrap: + stage: wrap + image: debian:stable-slim + variables: + ARCH: "Apple-ARM" + JRETAR: "OpenJDK17U-jre_aarch64_mac_hotspot_17.0.2_8.tar.gz" # Taken from https://adoptium.net/de/temurin/releases/?variant=openjdk17&jvmVariant=hotspot + script: + - dmg-wrapper/ci-build-dmg.sh $ARCH $JRETAR + artifacts: + name: "$CI_COMMIT_REF_NAME-sheepit-artifact-$ARCH-dmg" + paths: + - ./dmg-wrapper/SheepIt-$ARCH.dmg + expire_in: 1 week diff --git a/dmg-wrapper/OpenJDK11U-jre_x64_mac_hotspot_11.0.15_10.tar.gz b/dmg-wrapper/OpenJDK11U-jre_x64_mac_hotspot_11.0.15_10.tar.gz new file mode 100644 index 0000000..5f7d8eb Binary files /dev/null and b/dmg-wrapper/OpenJDK11U-jre_x64_mac_hotspot_11.0.15_10.tar.gz differ diff --git a/dmg-wrapper/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.2_8.tar.gz b/dmg-wrapper/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.2_8.tar.gz new file mode 100644 index 0000000..0cc8edc Binary files /dev/null and b/dmg-wrapper/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.2_8.tar.gz differ diff --git a/dmg-wrapper/SheepIt-Run.sh b/dmg-wrapper/SheepIt-Run.sh new file mode 100755 index 0000000..3c3f63f --- /dev/null +++ b/dmg-wrapper/SheepIt-Run.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -euo pipefail # Unofficial strict mode, see http://redsymbol.net/articles/unofficial-bash-strict-mode/ + +cd "$(dirname "$(readlink -f "$0")")" +# see https://stackoverflow.com/questions/3349105/how-can-i-set-the-current-working-directory-to-the-directory-of-the-script-in-ba +echo "Please only pin the first window - the launcher to the Dock" +echo "=============================" +echo "Loading and launching SheepIt" +nohup "$BIN" -Xdock:icon=./$APP.png -Djna.nosys=true -jar "$JAR" &>/dev/null & disown +osascript -e 'tell application "Terminal" to close (every window whose name contains "SheepIt-Run.sh")' & +exit 0 diff --git a/dmg-wrapper/SheepIt.png b/dmg-wrapper/SheepIt.png new file mode 100644 index 0000000..85d6155 Binary files /dev/null and b/dmg-wrapper/SheepIt.png differ diff --git a/dmg-wrapper/SheepIt.tar.gz b/dmg-wrapper/SheepIt.tar.gz new file mode 100644 index 0000000..33151ed Binary files /dev/null and b/dmg-wrapper/SheepIt.tar.gz differ diff --git a/dmg-wrapper/build-libdmg-hfsplus.sh b/dmg-wrapper/build-libdmg-hfsplus.sh new file mode 100755 index 0000000..d6c83ec --- /dev/null +++ b/dmg-wrapper/build-libdmg-hfsplus.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +sudo apt-get install git cmake build-essential zlib1g-dev + +git clone https://github.com/fanquake/libdmg-hfsplus.git +cd libdmg-hfsplus +cmake . -B build +make -C build/dmg -j8 +mv build/dmg/dmg .. +cd .. +rm -rf libdmg-hfsplus/ diff --git a/dmg-wrapper/ci-build-dmg.sh b/dmg-wrapper/ci-build-dmg.sh new file mode 100755 index 0000000..94cf42c --- /dev/null +++ b/dmg-wrapper/ci-build-dmg.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -euo pipefail # Unofficial strict mode, see http://redsymbol.net/articles/unofficial-bash-strict-mode/ + +cd "$(dirname "$(readlink -f "$0")")" +# see https://stackoverflow.com/questions/3349105/how-can-i-set-the-current-working-directory-to-the-directory-of-the-script-in-ba + +ARCH="$1" +JRETAR="$2" + +APP="SheepIt" +DMG="$APP-$ARCH-raw.dmg" +FINAL="$APP-$ARCH.dmg" + +BASE="$(pwd)" +BUILD="$BASE/build" +RES="$BUILD/SheepIt.app/Contents/Resources" +CL="$RES/client" + +apt-get update +apt-get install -y --no-install-recommends genisoimage # Add dependencies + +mkdir "$BUILD" +tar -axf "$APP.tar.gz" -C "$BUILD" # Extract base file structure + Platypus shell exec shim +tar -axf "$BASE/$JRETAR" -C "$RES" # Extracts the JRE into Resources folder + +mkdir -p "$CL" +cp ../sheepit-client-all.jar "$CL/$APP.jar" # Copy client artifact to be packaged +cp "$BASE/$APP-Run.sh" "$CL" +cp "$BASE/$APP.png" "$CL" + +cd "$CL" +ln -s "$(find ../ -name java)" $APP # We symlink java to make the title appearing in the dock to read "SheepIt", not "java" +cd "$BASE" + +genisoimage -D -V $APP -no-pad -r -apple -o "$DMG" "$BUILD" +./dmg "$DMG" "$FINAL" # Use libdmg based dmg tool to compress the dmg (and also make it read-only) diff --git a/dmg-wrapper/dmg b/dmg-wrapper/dmg new file mode 100755 index 0000000..e25dcac Binary files /dev/null and b/dmg-wrapper/dmg differ