homebrew-core/Formula/spoof-mac.rb

81 lines
2.8 KiB
Ruby

class SpoofMac < Formula
desc "Spoof your MAC address in macOS"
homepage "https://github.com/feross/SpoofMAC"
url "https://pypi.python.org/packages/9c/59/cc52a4c5d97b01fac7ff048353f8dc96f217eadc79022f78455e85144028/SpoofMAC-2.1.1.tar.gz"
sha256 "48426efe033a148534e1d4dc224c4f1b1d22299c286df963c0b56ade4c7dc297"
head "https://github.com/feross/SpoofMAC.git"
bottle do
cellar :any_skip_relocation
sha256 "f7972b66a491d8513262e3bdb9098850fe91e4c8e0e3d7a12efd24994e47dda5" => :high_sierra
sha256 "baa45eb53fc9e1a713ca7693351409f66c833834e7c7d0838115bcf5f38df555" => :sierra
sha256 "6c97eaa9a82f7eadb5c1127a0dcf9b0f9f1837e36d3e9978e989471322f42b4a" => :el_capitan
sha256 "927644491edf064dcc3145e05107737c3e571b55989ae8d539bf0b499da3685c" => :yosemite
sha256 "f7dc1529dd2c83d8bf8667d170299aa592910bb4918174b23f6a9b7d3555084e" => :mavericks
end
depends_on :python if MacOS.version <= :snow_leopard
resource "docopt" do
url "https://pypi.python.org/packages/source/d/docopt/docopt-0.6.2.tar.gz"
sha256 "49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"
end
def install
ENV["PYTHONPATH"] = libexec/"lib/python2.7/site-packages"
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
resources.each do |r|
r.stage { system "python", *Language::Python.setup_install_args(libexec/"vendor") }
end
system "python", *Language::Python.setup_install_args(libexec)
bin.install Dir[libexec/"bin/*"]
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end
def caveats; <<-EOS.undent
Although spoof-mac can run without root, you must be root to change the MAC.
The launchdaemon is set to randomize en0.
You can find the interfaces available by running:
"spoof-mac list"
If you wish to change interface randomized at startup change the plist line:
<string>en0</string>
to e.g.:
<string>en1</string>
EOS
end
plist_options :startup => true, :manual => "spoof-mac"
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/spoof-mac</string>
<string>randomize</string>
<string>en0</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
</dict>
</plist>
EOS
end
test do
system "#{bin}/spoof-mac", "list", "--wifi"
end
end