biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / applications / misc / 1password-gui / update.sh
blobfc6d350f2330514c3b6a13a49bd03601c222de05
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p jq
3 #shellcheck shell=bash
5 CURRENT_HASH=""
7 print_hash() {
8 OS="$1"
9 CHANNEL="$2"
10 ARCH="$3"
11 VERSION="$4"
13 if [[ "$OS" == "linux" ]]; then
14 if [[ "$ARCH" == "x86_64" ]]; then
15 EXT="x64.tar.gz"
16 else
17 EXT="arm64.tar.gz"
19 URL="https://downloads.1password.com/${OS}/tar/${CHANNEL}/${ARCH}/1password-${VERSION}.${EXT}"
20 else
21 EXT="$ARCH.zip"
22 URL="https://downloads.1password.com/${OS}/1Password-${VERSION}-${EXT}"
25 CURRENT_HASH=$(nix store prefetch-file "$URL" --json | jq -r '.hash')
27 echo "$CHANNEL ${ARCH}-${OS}: $CURRENT_HASH"
30 if [[ -z "$STABLE_VER" && -n "$1" ]]; then
31 STABLE_VER="$1"
34 if [[ -z "$BETA_VER" && -n "$2" ]]; then
35 BETA_VER="$2"
38 if [[ "${BETA_VER: -4}" != "BETA" ]]; then
39 BETA_VER="$BETA_VER.BETA"
42 if [[ -z "$STABLE_VER" ]]; then
43 echo "No 'STABLE_VER' environment variable provided, skipping"
44 else
45 print_hash "linux" "stable" "x86_64" "$STABLE_VER"
46 print_hash "linux" "stable" "aarch64" "$STABLE_VER"
47 print_hash "mac" "stable" "x86_64" "$STABLE_VER"
48 print_hash "mac" "stable" "aarch64" "$STABLE_VER"
51 if [[ -z "$BETA_VER" ]]; then
52 echo "No 'BETA_VER' environment variable provided, skipping"
53 else
54 print_hash "linux" "beta" "x86_64" "$BETA_VER"
55 print_hash "linux" "beta" "aarch64" "$BETA_VER"
56 print_hash "mac" "beta" "x86_64" "$BETA_VER"
57 print_hash "mac" "beta" "aarch64" "$BETA_VER"