2020-04-24 23:36:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
|
|
echo "$0: version" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
VERSION="$1"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
declare -A SYSTEMS HASHES
|
|
|
|
SYSTEMS=(
|
|
|
|
[i686-linux]=linux-ia32
|
|
|
|
[x86_64-linux]=linux-x64
|
|
|
|
[armv7l-linux]=linux-armv7l
|
|
|
|
[aarch64-linux]=linux-arm64
|
|
|
|
[x86_64-darwin]=darwin-x64
|
2021-05-20 23:08:51 +00:00
|
|
|
[aarch64-darwin]=darwin-arm64
|
2020-04-24 23:36:52 +00:00
|
|
|
)
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
hashfile="$(nix-prefetch-url --print-path "https://github.com/electron/electron/releases/download/v${VERSION}/SHASUMS256.txt" | tail -n1)"
|
|
|
|
headers="$(nix-prefetch-url "https://artifacts.electronjs.org/headers/dist/v${VERSION}/node-v${VERSION}-headers.tar.gz")"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-03 02:18:15 +00:00
|
|
|
# Entry similar to the following goes in default.nix:
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
echo " electron_${VERSION%%.*}-bin = mkElectron \"${VERSION}\" {"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
for S in "${!SYSTEMS[@]}"; do
|
2021-05-20 23:08:51 +00:00
|
|
|
hash="$(grep " *electron-v${VERSION}-${SYSTEMS[$S]}.zip$" "$hashfile"|cut -f1 -d' ' || :)"
|
|
|
|
if [[ -n $hash ]]; then
|
|
|
|
echo " $S = \"$hash\";"
|
|
|
|
fi
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
echo " headers = \"$headers\";"
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
echo " };"
|