about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/hubstaff/update.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/hubstaff/update.sh')
-rwxr-xr-xnixpkgs/pkgs/applications/misc/hubstaff/update.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/misc/hubstaff/update.sh b/nixpkgs/pkgs/applications/misc/hubstaff/update.sh
new file mode 100755
index 000000000000..c4c1caf55db4
--- /dev/null
+++ b/nixpkgs/pkgs/applications/misc/hubstaff/update.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p nix-prefetch-git curl
+
+SCRIPT_DIR=$(dirname "$(readlink -f "$BASH_SOURCE")")
+
+installation_script_url=$(curl --fail --head --location --silent --output /dev/null --write-out %{url_effective} https://app.hubstaff.com/download/linux)
+
+version=$(echo "$installation_script_url" | sed -r 's/^https:\/\/hubstaff\-production\.s3\.amazonaws\.com\/downloads\/HubstaffClient\/Builds\/Release\/([^\/]+)\/Hubstaff.+$/\1/')
+
+sha256=$(nix-prefetch-url "$installation_script_url")
+
+cat <<EOT > $SCRIPT_DIR/revision.json
+{
+  "url": "$installation_script_url",
+  "version": "$version",
+  "sha256": "$sha256"
+}
+EOT