Skip to content

Commit

Permalink
Merge pull request #75 from zchee/homebrew
Browse files Browse the repository at this point in the history
Add check binary owner on PreCreateCheck()
  • Loading branch information
zchee committed Jan 21, 2016
2 parents 4bdd76c + 64b81cf commit 525477c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ If you were doubt problem either, please post to this repository [issues](https:

## Install

Use [Homebrew/homebrew](https://github.com/Homebrew/homebrew),

```bash
$ brew install docker-machine-driver-xhyve

# docker-machine-driver-xhyve need root owner and uid
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
```

Use `go get`,

```bash
# Need Go 1.5 vendoring support
$ export GO15VENDOREXPERIMENT=1
Expand Down
10 changes: 10 additions & 0 deletions xhyve/xhyve.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,16 @@ func (d *Driver) PreCreateCheck() error {
ver +
"\n\t Please upgrade to version 5 at https://www.virtualbox.org/wiki/Downloads")
}

// Check binary owner
bin, err := os.Stat(os.Args[0])
if err != nil {
return err
}
if int(bin.Sys().(*syscall.Stat_t).Uid) == 501 {
return fmt.Errorf("%s need root owner. See https://github.com/zchee/docker-machine-driver-xhyve#install", os.Args[0])
}

return nil
}

Expand Down

0 comments on commit 525477c

Please sign in to comment.