summary refs log tree commit diff
path: root/pkgs/shells/powershell/getHashes.sh
blob: 4453d0703f121e76f2a45db10967b59efb5e1a4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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"