owmods-cli: update update script

+36
+36
pkgs/applications/misc/owmods-cli/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p curl gnused nix-prefetch nix-prefetch-github jq wget 3 + 4 + #modified version of https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/servers/readarr/update.sh 5 + set -e 6 + 7 + dirname="$(dirname "$0")" 8 + 9 + updateCliHash() 10 + { 11 + version=$1 12 + 13 + url="https://github.com/ow-mods/ow-mod-man/releases/cli_v$version" 14 + prefetchJson=$(nix-prefetch-github ow-mods ow-mod-man --rev cli_v$version) 15 + sha256="$(echo $prefetchJson | jq -r ".sha256")" 16 + 17 + sed -i "s|hash = \"[a-zA-Z0-9\/+-=]*\";|hash = \"sha256-$sha256\";|g" "$dirname/default.nix" 18 + #download and replace lock file 19 + wget https://raw.githubusercontent.com/ow-mods/ow-mod-man/cli_v$version/Cargo.lock -q -O $dirname/Cargo.lock 20 + 21 + } 22 + 23 + updateVersion() 24 + { 25 + sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix" 26 + } 27 + 28 + latestTag=$(curl https://api.github.com/repos/ow-mods/ow-mod-man/releases | jq -r ".[0].tag_name") 29 + latestVersion=${latestTag#*v} 30 + echo "latest version: ${latestVersion}" 31 + 32 + echo "updating..." 33 + updateVersion $latestVersion 34 + # 35 + updateCliHash $latestVersion 36 + echo "updated cli"