diff options
Diffstat (limited to 'pkgs/by-name/sa/sabnzbd/update.sh')
-rwxr-xr-x | pkgs/by-name/sa/sabnzbd/update.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/by-name/sa/sabnzbd/update.sh b/pkgs/by-name/sa/sabnzbd/update.sh new file mode 100755 index 0000000000000..d4cd47cfb5e92 --- /dev/null +++ b/pkgs/by-name/sa/sabnzbd/update.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p nix common-updater-scripts gnugrep gnused nurl + +# shellcheck shell=bash + +set -euo pipefail + +latestVersion=$(list-git-tags --url=https://github.com/sabnzbd/sabnzbd | grep -E '^[0-9.]+$' | sort --reverse --numeric-sort | head -n 1) +currentVersion=$(nix-instantiate --eval -E "with import ./. {}; sabnzbd.version or (lib.getVersion sabnzbd)" | tr -d '"') + +if [[ "$latestVersion" == "$currentVersion" ]]; then + echo "sabnzbd already latest version $latestVersion" + exit 0 +fi + +echo "sabnzbd updating $currentVersion -> $latestVersion" +update-source-version sabnzbd "$latestVersion" + +sabctoolsVersion=$(curl -s "https://raw.githubusercontent.com/sabnzbd/sabnzbd/$latestVersion/requirements.txt" | grep sabctools | cut -f 3 -d =) +sabctoolsHash=$(nurl --hash https://pypi.org/project/sabctools "$sabctoolsVersion") + +sed -i -E -e "s#sabctoolsVersion = \".*\"#sabctoolsVersion = \"$sabctoolsVersion\"#" ./pkgs/by-name/sa/sabnzbd/package.nix +sed -i -E -e "s#sabctoolsHash = \".*\"#sabctoolsHash = \"$sabctoolsHash\"#" ./pkgs/by-name/sa/sabnzbd/package.nix |