Skip to content

Commit

Permalink
Merge pull request #174765 from schuelermine/powershell-getHashes
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed May 30, 2022
2 parents 7c49511 + 1461002 commit 741e3c4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions pkgs/shells/powershell/getHashes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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
"

done
done

echo "$allOutput"

0 comments on commit 741e3c4

Please sign in to comment.