2019-01-09 07:20:37 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
|
|
echo "$0: version" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
VERSION=$1
|
|
|
|
|
|
|
|
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
|
|
|
|
)
|
|
|
|
|
2020-02-05 18:27:16 +00:00
|
|
|
hashfile="$(nix-prefetch-url --print-path "https://github.com/electron/electron/releases/download/v${VERSION}/SHASUMS256.txt" 2>/dev/null | tail -n1)"
|
2020-11-28 15:57:31 +00:00
|
|
|
headers="$(nix-prefetch-url "https://atom.io/download/electron/v${VERSION}/node-v${VERSION}-headers.tar.gz")"
|
2020-02-05 18:27:16 +00:00
|
|
|
|
2020-10-15 10:18:25 +01:00
|
|
|
# Entry similar to the following goes in default.nix:
|
|
|
|
|
2020-02-05 18:27:16 +00:00
|
|
|
echo " electron_${VERSION%%.*} = mkElectron \"${VERSION}\" {"
|
|
|
|
|
2019-01-09 07:20:37 +00:00
|
|
|
for S in "${!SYSTEMS[@]}"; do
|
2020-02-05 18:27:16 +00:00
|
|
|
hash="$(grep " *electron-v${VERSION}-${SYSTEMS[$S]}.zip$" "$hashfile"|cut -f1 -d' ')"
|
|
|
|
echo " $S = \"$hash\";"
|
2019-01-09 07:20:37 +00:00
|
|
|
done
|
|
|
|
|
2020-11-28 15:57:31 +00:00
|
|
|
echo " headers = \"$headers\";"
|
|
|
|
|
2020-02-05 18:27:16 +00:00
|
|
|
echo " };"
|