Skip to content

Commit 3783b87

Browse files
authored
Merge pull request #6 from cypherstack/fix/macos-shasum
fix(macos): add scripts/macos/download.sh
2 parents f5df643 + 3cbb98c commit 3783b87

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

scripts/macos/download.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
set -e
3+
4+
LIB_ROOT=../..
5+
REPO="cypherstack/flutter_libmwc"
6+
BASE_URL="https://github.com/${REPO}/releases/download"
7+
8+
TAG=$(git -C "$LIB_ROOT" describe --tags --exact-match HEAD 2>/dev/null) || {
9+
echo "Error: flutter_libmwc is not at a tagged commit."
10+
echo "Pin the submodule to a release tag to use download mode."
11+
echo "Current commit: $(git -C "$LIB_ROOT" rev-parse HEAD)"
12+
exit 1
13+
}
14+
15+
TMPDIR=$(mktemp -d)
16+
trap 'rm -rf "$TMPDIR"' EXIT
17+
18+
curl -fSL "${BASE_URL}/${TAG}/checksums.txt" -o "$TMPDIR/checksums.txt"
19+
20+
download_and_verify() {
21+
local asset="$1"
22+
curl -fSL "${BASE_URL}/${TAG}/${asset}" -o "$TMPDIR/${asset}"
23+
grep "^[0-9a-f]* ${asset}$" "$TMPDIR/checksums.txt" | (cd "$TMPDIR" && shasum -a 256 -c)
24+
}
25+
26+
download_and_verify "MWCWallet.xcframework.zip"
27+
28+
mkdir -p "$LIB_ROOT/macos/framework"
29+
rm -rf "$LIB_ROOT/macos/framework/MWCWallet.xcframework"
30+
unzip -q "$TMPDIR/MWCWallet.xcframework.zip" -d "$TMPDIR/xcfw"
31+
cp -r "$TMPDIR/xcfw/MWCWallet.xcframework" "$LIB_ROOT/macos/framework/MWCWallet.xcframework"

0 commit comments

Comments
 (0)