-
Notifications
You must be signed in to change notification settings - Fork 8
/
cosign.rb
62 lines (53 loc) · 2.11 KB
/
cosign.rb
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
59
60
61
62
# typed: false
# frozen_string_literal: true
class Cosign < Formula
desc "Container Signing, Verification and Storage in an OCI registry"
homepage "https://sigstore.dev"
version "2.4.1"
license "Apache-2.0"
head "https://github.com/sigstore/cosign.git", tag: "v2.4.1"
option "with-linux-piv-pkcs11", "Download cosign linux binary with piv/pkcs11 enabled"
on_macos do
depends_on "pcsc-lite"
if Hardware::CPU.intel?
url "https://github.com/sigstore/cosign/releases/download/v#{version}/cosign-darwin-amd64"
sha256 "666032ca283da92b6f7953965688fd51200fdc891a86c19e05c98b898ea0af4e"
end
if Hardware::CPU.arm?
url "https://github.com/sigstore/cosign/releases/download/v#{version}/cosign-darwin-arm64"
sha256 "13343856b69f70388c4fe0b986a31dde5958e444b41be22d785d3dc5e1a9cc62"
end
end
on_linux do
if Hardware::CPU.intel?
if build.with? "linux-piv-pkcs11"
url "https://github.com/sigstore/cosign/releases/download/v#{version}/cosign-linux-pivkey-pkcs11key-amd64"
sha256 "688c7b2f0712c95beb3cd7e9a12fe747bd394e5037ec4b8adc00de4d91d14c7c"
else
url "https://github.com/sigstore/cosign/releases/download/v#{version}/cosign-linux-amd64"
sha256 "8b24b946dd5809c6bd93de08033bcf6bc0ed7d336b7785787c080f574b89249b"
end
end
if Hardware::CPU.arm?
if build.with? "linux-piv-pkcs11"
url "https://github.com/sigstore/cosign/releases/download/v#{version}/cosign-linux-pivkey-pkcs11key-arm64"
sha256 "62ed36b2af5efb4f7b5d6bf2c20d325448127d3c416f231744697a8d55337308"
else
url "https://github.com/sigstore/cosign/releases/download/v#{version}/cosign-linux-arm64"
sha256 "3b2e2e3854d0356c45fe6607047526ccd04742d20bd44afb5be91fa2a6e7cb4a"
end
end
end
def install
cpu = Hardware::CPU.intel? ? "amd64" : "arm64"
os = OS.mac? ? "darwin" : "linux"
if build.with? "linux-piv-pkcs11"
bin.install "cosign-#{os}-pivkey-pkcs11key-#{cpu}" => "cosign"
else
bin.install "cosign-#{os}-#{cpu}" => "cosign"
end
end
test do
system "#{bin}/cosign", "version"
end
end