1#!/usr/bin/env nix-shell
2#!nix-shell -i bash -p bash nix-update common-updater-scripts nix
3
4set -euo pipefail
5
6currentVersion=$(nix-instantiate --eval -E "with import ./. {}; dbgate.version or (lib.getVersion dbgate)" | tr -d '"')
7nix-update dbgate
8latestVersion=$(nix-instantiate --eval -E "with import ./. {}; dbgate.version or (lib.getVersion dbgate)" | tr -d '"')
9
10if [[ "$currentVersion" == "$latestVersion" ]]; then
11 echo "package is up-to-date: $currentVersion"
12 exit 0
13fi
14
15for system in \
16 x86_64-linux \
17 aarch64-linux \
18 x86_64-darwin \
19 aarch64-darwin; do
20 hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 $(nix-prefetch-url $(nix-instantiate --eval -E "with import ./. {}; dbgate.src.url" --system "$system" | tr -d '"')))
21 update-source-version dbgate $latestVersion $hash --system=$system --ignore-same-version
22done