This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker-machine-driver-xhyve Formula
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require "language/go" | ||
|
||
class DockerMachineDriverXhyve < Formula | ||
desc "Docker Machine driver for xhyve" | ||
homepage "https://github.com/zchee/docker-machine-driver-xhyve" | ||
url "https://github.com/zchee/docker-machine-driver-xhyve/releases/download/v0.2.1/docker-machine-driver-xhyve" | ||
sha256 "d56db4635ad2f711d73b44508405277bddd5af439af2c82dbdd0da116e8d1380" | ||
|
||
head do | ||
url "https://github.com/zchee/docker-machine-driver-xhyve.git" | ||
|
||
depends_on "go" => :build | ||
end | ||
|
||
depends_on "docker-machine" | ||
|
||
def install | ||
if build.head? | ||
contents = Dir["{*,.git,.gitignore}"] | ||
gopath = buildpath/"gopath" | ||
(gopath/"src/github.com/zchee/docker-machine-driver-xhyve").install contents | ||
|
||
ENV["GOPATH"] = gopath | ||
ENV["GO15VENDOREXPERIMENT"] = "1" | ||
|
||
cd gopath/"src/github.com/zchee/docker-machine-driver-xhyve" do | ||
ENV["GIT_COMMIT"] = `git rev-parse --short HEAD 2>/dev/null`.gsub(/\n/,"") | ||
system "go", "build", "-o", "docker-machine-driver-xhyve", "-ldflags", "'-w -s'", "-ldflags", "-X 'github.com/zchee/docker-machine-driver-xhyve/xhyve.GitCommit=#{ENV['GIT_COMMIT']}'", "./main.go" | ||
bin.install "docker-machine-driver-xhyve" | ||
end | ||
else | ||
bin.install "docker-machine-driver-xhyve" | ||
end | ||
end | ||
|
||
def caveats; <<-EOS.undent | ||
docker-machine-driver-xhyve requires root privileges to correctly setup vmnet networking. | ||
Please change the driver's owner and set the setuid bit: | ||
sudo chown root:wheel #{bin}/docker-machine-driver-xhyve | ||
sudo chmod u+s #{bin}/docker-machine-driver-xhyve | ||
EOS | ||
end | ||
end |