From 1461002cc8c044dc466b810ed345f5bb66f75734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Thu, 26 May 2022 05:17:02 +0200 Subject: [PATCH] powershell: add maintainer script getHashes --- pkgs/shells/powershell/getHashes.sh | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 pkgs/shells/powershell/getHashes.sh diff --git a/pkgs/shells/powershell/getHashes.sh b/pkgs/shells/powershell/getHashes.sh new file mode 100755 index 000000000000..4453d0703f12 --- /dev/null +++ b/pkgs/shells/powershell/getHashes.sh @@ -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"