_7zz: improve update.sh script

This commit is contained in:
Thiago Kenji Okada 2022-07-23 12:25:22 +01:00
parent 57d8154c4e
commit 217e40ec41

View File

@ -1,13 +1,14 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils gnused curl jq
#! nix-shell -i bash -p coreutils gnused curl jq nix-prefetch
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
DRV_DIR="$PWD"
OLD_VERSION="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
NEW_VERSION="$(curl "https://sourceforge.net/projects/sevenzip/best_release.json" | jq '.platform_releases.linux.filename' -r | cut -d/ -f3)"
# The best_release.json is not always up-to-date
# In those cases you can force the version by calling `./update.sh <newer_version>`
NEW_VERSION="${1:-$(curl 'https://sourceforge.net/projects/sevenzip/best_release.json' | jq '.platform_releases.linux.filename' -r | cut -d/ -f3)}"
echo "comparing versions $OLD_VERSION => $NEW_VERSION"
if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then