install.sh
Shell command-substitution syntaxarm64 architecture string
SHA-2561c816596d9ebe5af502d18f90ac29bc5e263b5fdd4a77ec3423f1e277d63838d
MaleculeK(Am)H₅(Cm₁₃Db₃F₆Os₄Po₂)
Evidence
1#!/bin/bash
2
3set -e
4
5get_os() {
6 case "$(uname -s)" in
7 Linux*) OS=linux;;
8 Darwin*) OS=darwin;;
9 MINGW*|MSYS*|CYGWIN*) OS=windows;;
10 *) echo "Unsupported operating system"; exit 1;;
11 esac
12 echo "$OS"
13}
14
15get_arch() {
16 case "$(uname -m)" in
17 x86_64) ARCH=amd64;;
18 arm64) ARCH=arm64;;
19 *) echo "Unsupported architecture"; exit 1;;
20 esac
21 echo "$ARCH"
22}
23
24get_latest_version() {
25 curl -s "https://api.github.com/repos/$OWNER/$NAME/releases/latest" | grep -o '"tag_name": ".*"' | sed 's/"tag_name": "//;s/"//'
26}
27
28OWNER="flowexec"
29NAME="flow"
30BINARY="flow"
31
32OS=$(get_os)
33ARCH=$(get_arch)
34if [ -z "$VERSION" ]; then
35 VERSION=$(get_latest_version)
36fi
37
38if [ "$OS" = "windows" ]; then
39 EXT="zip"
40 BINARY_NAME="${BINARY}.exe"
41else
42 EXT="tar.gz"
43 BINARY_NAME="${BINARY}"
44fi
45
46DOWNLOAD_URL="https://github.com/${OWNER}/${NAME}/releases/download/${VERSION}/${BINARY}_${VERSION}_${OS}_${ARCH}.${EXT}"
47TMP_DIR=$(mktemp -d)
48DOWNLOAD_PATH="${TMP_DIR}/${BINARY}_${VERSION}_${OS}_${ARCH}.${EXT}"