77 lines
2.4 KiB
Ruby
77 lines
2.4 KiB
Ruby
class SpoofMac < Formula
|
|
homepage "https://github.com/feross/SpoofMAC"
|
|
url "https://pypi.python.org/packages/source/S/SpoofMAC/SpoofMAC-2.0.3.tar.gz"
|
|
sha1 "fdd80539fc9fdd058cd167a07cbab9f41186d51b"
|
|
head "https://github.com/feross/SpoofMAC.git"
|
|
|
|
bottle do
|
|
sha1 "39c3d357cf21945a30d3866874c81c7423737056" => :yosemite
|
|
sha1 "0dcd2f368e9f5c08c33e982bfc8fe746193bb6ab" => :mavericks
|
|
sha1 "06cae93bd22951b3d119737f5827759bf2f4f904" => :mountain_lion
|
|
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"
|
|
sha1 "224a3ec08b56445a1bd1583aad06b00692671e04"
|
|
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_symlink "spoof-mac.py" => "spoof-mac"
|
|
bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"])
|
|
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>#{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
|
|
|
|
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
|
|
|
|
test do
|
|
system "#{bin}/spoof-mac", "list", "--wifi"
|
|
end
|
|
end
|