blob: fc6d350f2330514c3b6a13a49bd03601c222de05 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p jq
#shellcheck shell=bash
CURRENT_HASH=""
print_hash() {
OS="$1"
CHANNEL="$2"
ARCH="$3"
VERSION="$4"
if [[ "$OS" == "linux" ]]; then
if [[ "$ARCH" == "x86_64" ]]; then
EXT="x64.tar.gz"
else
EXT="arm64.tar.gz"
fi
URL="https://downloads.1password.com/${OS}/tar/${CHANNEL}/${ARCH}/1password-${VERSION}.${EXT}"
else
EXT="$ARCH.zip"
URL="https://downloads.1password.com/${OS}/1Password-${VERSION}-${EXT}"
fi
CURRENT_HASH=$(nix store prefetch-file "$URL" --json | jq -r '.hash')
echo "$CHANNEL ${ARCH}-${OS}: $CURRENT_HASH"
}
if [[ -z "$STABLE_VER" && -n "$1" ]]; then
STABLE_VER="$1"
fi
if [[ -z "$BETA_VER" && -n "$2" ]]; then
BETA_VER="$2"
fi
if [[ "${BETA_VER: -4}" != "BETA" ]]; then
BETA_VER="$BETA_VER.BETA"
fi
if [[ -z "$STABLE_VER" ]]; then
echo "No 'STABLE_VER' environment variable provided, skipping"
else
print_hash "linux" "stable" "x86_64" "$STABLE_VER"
print_hash "linux" "stable" "aarch64" "$STABLE_VER"
print_hash "mac" "stable" "x86_64" "$STABLE_VER"
print_hash "mac" "stable" "aarch64" "$STABLE_VER"
fi
if [[ -z "$BETA_VER" ]]; then
echo "No 'BETA_VER' environment variable provided, skipping"
else
print_hash "linux" "beta" "x86_64" "$BETA_VER"
print_hash "linux" "beta" "aarch64" "$BETA_VER"
print_hash "mac" "beta" "x86_64" "$BETA_VER"
print_hash "mac" "beta" "aarch64" "$BETA_VER"
fi
|