52 lines
2.1 KiB
Ruby
52 lines
2.1 KiB
Ruby
class NewrelicInfraAgent < Formula
|
|
desc "New Relic infrastructure agent"
|
|
homepage "https://github.com/newrelic/infrastructure-agent"
|
|
url "https://github.com/newrelic/infrastructure-agent.git",
|
|
tag: "1.23.2",
|
|
revision: "1f20119da9091a113c9f5c71546e418f09427b64"
|
|
license "Apache-2.0"
|
|
head "https://github.com/newrelic/infrastructure-agent.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, monterey: "ec7652f22b7ca13010afcd99b01864da16b02d5953df75b86650300ce68c7062"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "0d0a1271d51fca8aca2362ffd27ea511ac8b7fff10281a0c700af09202fa61ca"
|
|
sha256 cellar: :any_skip_relocation, catalina: "12c6016fa394b888b0412336383471074fb8d9300c02945a95d1858c4ac0ad36"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "699efd4b9a366cb3ff9496330dd021de558f15995b928f93ebb55c35451b0f91"
|
|
end
|
|
|
|
# https://github.com/newrelic/infrastructure-agent/issues/723
|
|
depends_on "go@1.16" => :build
|
|
# https://github.com/newrelic/infrastructure-agent/issues/695
|
|
depends_on arch: :x86_64
|
|
|
|
def install
|
|
goarch = Hardware::CPU.intel? ? "amd64" : Hardware::CPU.arch.to_s
|
|
os = OS.kernel_name.downcase
|
|
ENV["VERSION"] = version.to_s
|
|
ENV["GOOS"] = os
|
|
ENV["CGO_ENABLED"] = OS.mac? ? "1" : "0"
|
|
|
|
system "make", "dist-for-os"
|
|
bin.install "dist/#{os}-newrelic-infra_#{os}_#{goarch}/newrelic-infra"
|
|
bin.install "dist/#{os}-newrelic-infra-ctl_#{os}_#{goarch}/newrelic-infra-ctl"
|
|
bin.install "dist/#{os}-newrelic-infra-service_#{os}_#{goarch}/newrelic-infra-service"
|
|
(var/"db/newrelic-infra").install "assets/licence/LICENSE.macos.txt" if OS.mac?
|
|
end
|
|
|
|
def post_install
|
|
(etc/"newrelic-infra").mkpath
|
|
(var/"log/newrelic-infra").mkpath
|
|
end
|
|
|
|
service do
|
|
run [bin/"newrelic-infra-service", "-config", etc/"newrelic-infra/newrelic-infra.yml"]
|
|
log_path var/"log/newrelic-infra/newrelic-infra.log"
|
|
error_log_path var/"log/newrelic-infra/newrelic-infra.stderr.log"
|
|
end
|
|
|
|
test do
|
|
output = shell_output("#{bin}/newrelic-infra -validate")
|
|
assert_match "config validation", output
|
|
end
|
|
end
|