-
Notifications
You must be signed in to change notification settings - Fork 1
/
gen.sh
executable file
·57 lines (50 loc) · 1.71 KB
/
gen.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
#!/bin/bash
version=$(cat version.txt)
macosamd64sha=$(cat dist/checksums.txt | grep spot_darwin_amd64 | awk '{print $1}')
macosarm64sha=$(cat dist/checksums.txt | grep spot_darwin_arm64| awk '{print $1}')
linuxamd64sha=$(cat dist/checksums.txt | grep spot_linux_amd64 | awk '{print $1}')
linuxarm64sha=$(cat dist/checksums.txt | grep spot_linux_arm64 | awk '{print $1}')
cat > spotvm.rb <<EOF
class Spotvm < Formula
desc "spot vm tool"
homepage "https://github.com/ysicing/spot"
version "${version}"
if OS.mac?
if Hardware::CPU.arm?
url "https://github.com/ysicing/spot/releases/download/v#{version}/spot_darwin_arm64"
sha256 "${macosarm64sha}"
else
url "https://github.com/ysicing/spot/releases/download/v#{version}/spot_darwin_amd64"
sha256 "${macosamd64sha}"
end
elsif OS.linux?
if Hardware::CPU.intel?
url "https://github.com/ysicing/spot/releases/download/v#{version}/spot_linux_amd64"
sha256 "${linuxamd64sha}"
end
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "https://github.com/ysicing/spot/releases/download/v#{version}/spot_linux_arm64"
sha256 "${linuxarm64sha}"
end
end
def install
if OS.mac?
if Hardware::CPU.intel?
bin.install "spot_darwin_amd64" => "spotvm"
else
bin.install "spot_darwin_arm64" => "spotvm"
end
elsif OS.linux?
if Hardware::CPU.intel?
bin.install "spot_linux_amd64" => "spotvm"
else
bin.install "spot_linux_arm64" => "spotvm"
end
end
end
test do
assert_match "spotvm vervion v#{version}", shell_output("#{bin}/spotvm -v")
end
end
EOF
cat spotvm.rb