about summary refs log tree commit diff
path: root/pkgs/applications/networking/breitbandmessung/update.sh
diff options
context:
space:
mode:
authorannalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com>2024-03-16 00:07:22 +0000
committerannalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com>2024-03-16 00:07:22 +0000
commit636ed70ab399ac72783a1bf6cb01941f2af7361a (patch)
tree2253550c7aff328e3860c8f0167b4e515ea978af /pkgs/applications/networking/breitbandmessung/update.sh
parentdefa6665ee701f4a149db89728eac72f3100b2a8 (diff)
parent00729a3d21641fedad8e956a37efeedc220a2499 (diff)
Merge remote-tracking branch 'upstream/staging-next' into staging
Diffstat (limited to 'pkgs/applications/networking/breitbandmessung/update.sh')
-rwxr-xr-xpkgs/applications/networking/breitbandmessung/update.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/applications/networking/breitbandmessung/update.sh b/pkgs/applications/networking/breitbandmessung/update.sh
new file mode 100755
index 0000000000000..da982adf933bb
--- /dev/null
+++ b/pkgs/applications/networking/breitbandmessung/update.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl jq nix ripgrep
+
+set -xeu -o pipefail
+
+PACKAGE_DIR="$(realpath "$(dirname "$0")")"
+
+current="$(nix eval -f "$PACKAGE_DIR/sources.nix" --raw version || :)"
+latest="$(curl -sS https://breitbandmessung.de/desktop-app | \
+  rg '.*Aktuelle Version der Desktop-App lautet:\s*([.0-9]+).*' -r '$1')"
+
+if [[ $current != $latest ]]; then
+  linux_hash="$(nix store prefetch-file --json https://download.breitbandmessung.de/bbm/Breitbandmessung-${latest}-linux.deb | jq -r .hash)"
+  darwin_hash="$(nix store prefetch-file --json https://download.breitbandmessung.de/bbm/Breitbandmessung-${latest}-mac.dmg | jq -r .hash)"
+
+  cat <<EOF >"$PACKAGE_DIR/sources.nix"
+{
+  version = "${latest}";
+  x86_64-linux = {
+    url = "https://download.breitbandmessung.de/bbm/Breitbandmessung-${latest}-linux.deb";
+    sha256 = "${linux_hash}";
+  };
+  x86_64-darwin = {
+    url = "https://download.breitbandmessung.de/bbm/Breitbandmessung-${latest}-mac.dmg";
+    sha256 = "${darwin_hash}";
+  };
+}
+EOF
+fi