56 lines
2.1 KiB
Ruby
56 lines
2.1 KiB
Ruby
class Teleport < Formula
|
|
desc "Modern SSH server for teams managing distributed infrastructure"
|
|
homepage "https://gravitational.com/teleport"
|
|
url "https://github.com/gravitational/teleport/archive/v2.3.1.tar.gz"
|
|
sha256 "d15e79811903d1fe8f34358355a5c6572d8a209e684ccc835600d3a273448c3f"
|
|
|
|
bottle do
|
|
sha256 "9480a138955b7bc317a4d8de3b12a2ad323c121905e7d509431759c393fe99b7" => :high_sierra
|
|
sha256 "39c0cd3bd8059e410e8e76c4482da138df47fbb21b72b7a4f7ad19e8274acfdb" => :sierra
|
|
sha256 "f080e1e098055748c5413968a78284da7326d36dedb6db978553c4fa7b3c4326" => :el_capitan
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
conflicts_with "etsh", :because => "both install `tsh` binaries"
|
|
|
|
def install
|
|
ENV["GOOS"] = "darwin"
|
|
ENV["GOARCH"] = MacOS.prefer_64_bit? ? "amd64" : "386"
|
|
ENV["GOPATH"] = buildpath
|
|
ENV["GOROOT"] = Formula["go"].opt_libexec
|
|
|
|
(buildpath / "src/github.com/gravitational/teleport").install buildpath.children
|
|
ln_s buildpath/"src", buildpath / "src/github.com/gravitational/teleport"
|
|
|
|
cd "src/github.com/gravitational/teleport" do
|
|
ENV.deparallelize { system "make", "release" }
|
|
system "/usr/bin/tar", "-xvf", "teleport-v#{version}-#{ENV["GOOS"]}-#{ENV["GOARCH"]}-bin.tar.gz"
|
|
cd "teleport" do
|
|
bin.install %w[teleport tctl tsh]
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/teleport version")
|
|
assert_match version.to_s, shell_output("#{bin}/tctl version")
|
|
assert_match version.to_s, shell_output("#{bin}/tsh version")
|
|
(testpath/"config.yml").write shell_output("#{bin}/teleport configure")
|
|
.gsub("0.0.0.0", "127.0.0.1")
|
|
.gsub("/var/lib/teleport", testpath)
|
|
.gsub("/var/run", testpath)
|
|
.gsub(/https_(.*)/, "")
|
|
begin
|
|
pid = spawn("#{bin}/teleport start -c #{testpath}/config.yml")
|
|
sleep 5
|
|
system "/usr/bin/curl", "--insecure", "https://localhost:3080"
|
|
system "/usr/bin/nc", "-z", "localhost", "3022"
|
|
system "/usr/bin/nc", "-z", "localhost", "3023"
|
|
system "/usr/bin/nc", "-z", "localhost", "3025"
|
|
ensure
|
|
Process.kill(9, pid)
|
|
end
|
|
end
|
|
end
|