Skip to content

Commit

Permalink
etcd: set ETCD_UNSUPPORTED_ARCH for Arm64 (#76995)
Browse files Browse the repository at this point in the history
it builds on Arm, it's not explicitly supported on m1 yet

- Use a service block for etcd
- remove plist section

Co-authored-by: Allen Reese <areese999@apple.com>
  • Loading branch information
areese and Allen Reese committed May 11, 2021
1 parent 6cc572b commit ba2212a
Showing 1 changed file with 15 additions and 24 deletions.
39 changes: 15 additions & 24 deletions Formula/etcd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,26 @@ def install

plist_options manual: "etcd"

def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/etcd</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{var}</string>
</dict>
</plist>
EOS
service do
environment_variables ETCD_UNSUPPORTED_ARCH: "arm64" if Hardware::CPU.arm?
run [opt_bin/"etcd"]
run_type :immediate
keep_alive true
working_dir var
end

test do
test_string = "Hello from brew test!"
etcd_pid = fork do
on_macos do
if Hardware::CPU.arm?
# etcd isn't officially supported on arm64
# https://github.com/etcd-io/etcd/issues/10318
# https://github.com/etcd-io/etcd/issues/10677
ENV["ETCD_UNSUPPORTED_ARCH"]="arm64"
end
end

exec bin/"etcd",
"--enable-v2", # enable etcd v2 client support
"--force-new-cluster",
Expand Down

0 comments on commit ba2212a

Please sign in to comment.