Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 39 lines 1.2 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p curl jq xxd gnused diffutils 3set -eu -o pipefail 4 5SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" 6 7curl -s 'https://portswigger.net/burp/releases/data' | 8 jq -r ' 9 [[ 10 .ResultSet.Results[] 11 | select( 12 (.categories | sort) == (["Professional","Community"] | sort) 13 and .releaseChannels == ["Early Adopter"] 14 ) 15 ][0].builds[] 16 | select(.ProductPlatform == "Jar") 17 ]' >latest.json 18 19version=$(jq -r '.[0].Version' latest.json) 20 21comm_hex=$(jq -r '.[] | select(.ProductId=="community") .Sha256Checksum' latest.json) 22pro_hex=$(jq -r '.[] | select(.ProductId=="pro") .Sha256Checksum' latest.json) 23 24comm_sri="sha256-$(printf %s "$comm_hex" | xxd -r -p | base64 -w0)" 25pro_sri="sha256-$(printf %s "$pro_hex" | xxd -r -p | base64 -w0)" 26 27sed -i \ 28 -e "s|^\(\s*version = \)\"[^\"]*\";|\1\"$version\";|" \ 29 -e "/productName = \"community\"/,/hash =/ { 30 s|sha256-[^\"]*|$comm_sri| 31 }" \ 32 -e "/productName = \"pro\"/,/hash =/ { 33 s|sha256-[^\"]*|$pro_sri| 34 }" \ 35 $SCRIPT_DIR/package.nix 36 37echo "burpsuite → $version" 38echo " community: $comm_sri" 39echo " pro : $pro_sri"