From efbf30f2402ca76f9b9f77c5f3111f0dbfa253d9 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 31 Mar 2023 00:15:02 -0700 Subject: [PATCH] Add tools/repack-windows-release.sh --- tools/repack-windows-release.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 tools/repack-windows-release.sh diff --git a/tools/repack-windows-release.sh b/tools/repack-windows-release.sh new file mode 100755 index 00000000..d7eebc40 --- /dev/null +++ b/tools/repack-windows-release.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# This script takes in the path to a windows-CLANGARM64-bin artifact downloaded +# from GitHub Actions, which lacks the PDF documentation and has the wrong file +# layout, and packs it up into a releasable zip file. Assumes that an x86_64 +# zip built from the same commit already exists locally. + +set -e -u + +usage() +{ + echo 1>&1 "Usage: $0 windows-CLANGARM64-bin.zip" + exit 1 +} + +[ $# -eq 1 ] || usage + +tmpdir=$(mktemp -d) +trap 'rm -rf "$tmpdir"' EXIT + +ZIP_FROM_GITHUB=$1 +unzip -q -d "$tmpdir" "$ZIP_FROM_GITHUB" +DESTDIR=$(basename "$(echo "$tmpdir"/*)") +rm -rf "$DESTDIR" "$DESTDIR.zip" +cp -a "$tmpdir/$DESTDIR" "$DESTDIR" +prefix=$(echo "$DESTDIR" | grep -o 'wimlib.*windows') +cp -a "${prefix}-x86_64-bin/doc" "$DESTDIR/doc" +chmod +x "$DESTDIR"/*.{dll,exe,cmd} +cd "$DESTDIR" +7z -mx9 a ../"$DESTDIR.zip" . > /dev/null +cd .. +echo "Success! Output is in $DESTDIR.zip" -- 2.43.0