depot/third_party/nixpkgs/pkgs/shells/powershell/getHashes.sh
Default email a0cb138ada Project import generated by Copybara.
GitOrigin-RevId: a100acd7bbf105915b0004427802286c37738fef
2023-02-02 18:25:31 +00:00

39 lines
712 B
Bash
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash wget coreutils gnutar nix
version=$1
if [[ -z $version ]]
then
echo "Pass the version to get hashes for as an argument"
exit 1
fi
allOutput=""
dlDest=$(mktemp)
exDest=$(mktemp -d)
trap 'rm $dlDest; rm -r $exDest' EXIT
for plat in osx linux; do
for arch in x64 arm64; do
URL="https://github.com/PowerShell/PowerShell/releases/download/v$version/powershell-$version-$plat-$arch.tar.gz"
wget $URL -O $dlDest >&2
tar -xzf $dlDest -C $exDest >&2
hash=$(nix hash path $exDest)
allOutput+="
variant: $plat $arch
hash: $hash
"
rm -r $exDest
mkdir $exDest
done
done
echo "$allOutput"