anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / tools / archivers / 7zz / update.sh
blob1128cedd54913d01d03cf9d138a2a452b05ebebe
1 #! /usr/bin/env nix-shell
2 #! nix-shell -I nixpkgs=./. -i bash -p curl xq-xml common-updater-scripts
3 set -euo pipefail
5 OLD_VERSION="$(nix-instantiate --eval --json --expr 'let pkgs = import ./. {}; in pkgs._7zz.version' | sed 's/"//g')"
6 NEW_VERSION="$(curl -H 'Accept: application/rss+xml' 'https://sourceforge.net/projects/sevenzip/rss?path=/7-Zip' | xq -x "substring((/rss/channel/item[link[contains(., 'src.tar.xz')]])[1]/title, 8, 5)")"
8 echo "comparing versions $OLD_VERSION => $NEW_VERSION"
9 if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then
10 echo "Already up to date! Doing nothing"
11 exit 0
14 update-source-version _7zz "$NEW_VERSION"
15 update-source-version _7zz-rar "$NEW_VERSION" --ignore-same-version