-
Notifications
You must be signed in to change notification settings - Fork 2
/
formula_template.sh
executable file
·58 lines (48 loc) · 1.67 KB
/
formula_template.sh
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
#!/bin/bash
# e.g 0.1.3
ARCHIVE_URL="https://github.com/estuary/flow/archive/refs/tags/v{$FLOW_RELEASE_NAME}.tar.gz"
DOWNLOADS_BASE="https://github.com/estuary/flow/releases/download"
MACOS_BINARY="$DOWNLOADS_BASE/v$FLOW_RELEASE_NAME/flowctl-multiarch-macos"
LINUX_X86_BINARY="$DOWNLOADS_BASE/v$FLOW_RELEASE_NAME/flowctl-x86_64-linux"
ARCHIVE_SHA=$(curl -sL "$ARCHIVE_URL" | shasum -a 256 | cut -f 1 -d " ")
MACOS_SHA=$(curl -sL "$MACOS_BINARY" | shasum -a 256 | cut -f 1 -d " ")
LINUX_X86_SHA=$(curl -sL "$LINUX_X86_BINARY" | shasum -a 256 | cut -f 1 -d " ")
cat << EOF
class Flowctl < Formula
desc "Command line interface for Flow"
homepage "https://github.com/estuary/flow"
# When updating this formula to a new version, you need to update this url as well as the "sha256" and "version" below!
# For example: "shasum -a 256 v0.3.2.tar.gz"
url "https://github.com/estuary/flow/archive/refs/tags/v$FLOW_RELEASE_NAME.tar.gz"
sha256 "$ARCHIVE_SHA"
license "Business Source License 1.1"
version "$FLOW_RELEASE_NAME"
on_macos do
resource "flowctl-binary" do
url "$MACOS_BINARY"
sha256 "$MACOS_SHA"
end
end
on_linux do
on_arm do
raise "flowctl can only be installed on x86_64 linux systems, please reach out to [email protected] if you need flowctl on arm"
end
resource "flowctl-binary" do
url "$LINUX_X86_BINARY"
sha256 "$LINUX_X86_SHA"
end
end
def install
binary_name = "flowctl-multiarch-macos"
if OS.linux?
binary_name = "flowctl-x86_64-linux"
end
resource("flowctl-binary").stage do
bin.install binary_name => "flowctl"
end
end
test do
system "flowctl", "--version"
end
end
EOF