Skip to content

Commit

Permalink
use 64-bit 7z-zstd to compress, but 32-bit sfx
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyd2019 committed Nov 30, 2021
1 parent 3f9620e commit 305698e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions create-sfx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
set -e

# Download and extract https://github.com/mcmilk/7-Zip-zstd
NAME="7z21.03-zstd-x32"
CHECKSUM="79382f65a6903726157b385ae5e2baae7c9ca39eb157f1d08040ee112e99d8f1"
NAME="7z21.03-zstd-x64"
CHECKSUM="531b20dfb03d8f30f61ae56a181610bbb6f3cf7cc71dac1d8f95511289de76f3"
DIR="$( cd "$( dirname "$0" )" && pwd )"
mkdir -p "$DIR/_cache"
BASE="$DIR/_cache/$NAME"
Expand All @@ -17,12 +17,25 @@ if [ ! -d "$BASE" ]; then
7z e -o"$BASE" "$DIR/_cache/$NAME.exe"
fi

NAME="7z21.03-zstd-x32"
CHECKSUM="79382f65a6903726157b385ae5e2baae7c9ca39eb157f1d08040ee112e99d8f1"
DIR="$( cd "$( dirname "$0" )" && pwd )"
mkdir -p "$DIR/_cache"
BASE32="$DIR/_cache/$NAME"
if [ ! -f "$BASE32.exe" ]; then
curl --fail -L "https://github.com/mcmilk/7-Zip-zstd/releases/download/v21.03-v1.5.0-R2/$NAME.exe" -o "$BASE32.exe"
fi
echo "$CHECKSUM $BASE32.exe" | sha256sum --quiet --check
if [ ! -d "$BASE32" ]; then
7z e -o"$BASE32" "$DIR/_cache/$NAME.exe"
fi

# Creat SFX installer
INPUT="$1"
OUTPUT="$2"
TEMP="$OUTPUT.payload"

rm -f "$TEMP"
"$BASE/7z" a "$TEMP" -ms1T -m0=zstd -mx22 "$INPUT"
cat "$BASE/7zCon.sfx" "$TEMP" > "$OUTPUT"
cat "$BASE32/7zCon.sfx" "$TEMP" > "$OUTPUT"
rm "$TEMP"

0 comments on commit 305698e

Please sign in to comment.