Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Add docker-machine-driver-xhyve Formula
Browse files Browse the repository at this point in the history
  • Loading branch information
zchee committed Jan 12, 2016
1 parent bf1c2dc commit da693b0
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Library/Formula/docker-machine-driver-xhyve.rb
@@ -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

0 comments on commit da693b0

Please sign in to comment.