dbeaver-bin: improve update script

Make the script runnable from any directory now, not only the root of nixpkgs
This commit is contained in:
Zexin Yuan 2025-05-07 11:14:44 +08:00
parent 08806429db
commit 86415e1813
No known key found for this signature in database

View File

@ -1,8 +1,9 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts
BASEDIR="$(dirname "$0")/../../../.."
latestVersion=$(curl "https://api.github.com/repos/dbeaver/dbeaver/tags" | jq -r '.[0].name')
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; dbeaver-bin.version" | tr -d '"')
currentVersion=$(nix-instantiate --eval -E "with import ${BASEDIR} {}; lib.getVersion dbeaver-bin" | tr -d '"')
echo "latest version: $latestVersion"
echo "current version: $currentVersion"
@ -22,5 +23,5 @@ do
prefetch=$(nix-prefetch-url "https://github.com/dbeaver/dbeaver/releases/download/$latestVersion/dbeaver-ce-$latestVersion-$2")
hash=$(nix-hash --type sha256 --to-sri $prefetch)
update-source-version dbeaver-bin $latestVersion $hash --system=$1 --ignore-same-version
(cd "$BASEDIR" && update-source-version dbeaver-bin $latestVersion $hash --system=$1 --ignore-same-version)
done