nixpkgs/pkgs/development/tools/electron/print-hashes.sh
Pavol Rusnak c46b2a31bb
electron: remove extra output from print-hashes script
to make it more usable for automated update
2020-10-28 14:58:12 +01:00

34 lines
748 B
Bash
Executable File

#!/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
)
hashfile="$(nix-prefetch-url --print-path "https://github.com/electron/electron/releases/download/v${VERSION}/SHASUMS256.txt" 2>/dev/null | tail -n1)"
# Entry similar to the following goes in default.nix:
echo " electron_${VERSION%%.*} = mkElectron \"${VERSION}\" {"
for S in "${!SYSTEMS[@]}"; do
hash="$(grep " *electron-v${VERSION}-${SYSTEMS[$S]}.zip$" "$hashfile"|cut -f1 -d' ')"
echo " $S = \"$hash\";"
done
echo " };"