Skip to content

Commit

Permalink
fix darwin configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
reddec committed Apr 13, 2020
1 parent 67e3f45 commit 7147c40
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 6 deletions.
20 changes: 17 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
install: backend

tools:
GO111MODULE=off go get -u -v github.com/go-bindata/go-bindata/...
GO111MODULE=off go get -u -v github.com/reddec/struct-view/cmd/events-gen
GO111MODULE=off go get -u -v github.com/reddec/jsonrpc2/cmd/...
GO111MODULE=off go get -v github.com/go-bindata/go-bindata/...
GO111MODULE=off go get -v github.com/reddec/struct-view/cmd/events-gen
GO111MODULE=off go get -v github.com/reddec/jsonrpc2/cmd/...

ui:
cd web/ui && npm i && npm run build
Expand All @@ -16,4 +16,18 @@ regen: tools ui
backend: regen
go build -o tinc-web-boot -v ./cmd/tinc-web-boot/main.go

linux:
mkdir -p build
GOOS=linux go build -o build/tinc-web-boot -v ./cmd/tinc-web-boot/main.go

darwin:
mkdir -p build
GOOS=darwin go build -o build/tinc-web-boot -v ./cmd/tinc-web-boot/main.go

windows:
mkdir -p build
GOOS=windows go build -o build/tinc-web-boot -v ./cmd/tinc-web-boot/main.go

checkplatform: linux windows darwin

.PHONY: install
4 changes: 4 additions & 0 deletions network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ func (network *Network) defineConfiguration() error {
AutoStart: false,
}

if err := network.beforeConfigure(config); err != nil {
return err
}

if err := network.Update(config); err != nil {
return err
}
Expand Down
14 changes: 14 additions & 0 deletions network/network_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package network

import (
"context"
)

func (network *Network) postConfigure(ctx context.Context, config *Config, tincBin string) error {
return nil
}

func (network *Network) beforeConfigure(config *Config) error {
config.Interface = ""
return nil
}
6 changes: 4 additions & 2 deletions network/network_posix.go → network/network_linux.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build darwin linux

package network

import (
Expand All @@ -9,3 +7,7 @@ import (
func (network *Network) postConfigure(ctx context.Context, config *Config, tincBin string) error {
return nil
}

func (network *Network) beforeConfigure(config *Config) error {
return nil
}
4 changes: 4 additions & 0 deletions network/network_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,7 @@ func (network *Network) findTapInstall(tincBin string) (string, error) {
}
return res, err
}

func (network *Network) beforeConfigure(config *Config) error {
return nil
}
2 changes: 1 addition & 1 deletion utils/cmd.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//

// +build !linux
// +build !linux,!darwin

package utils

Expand Down
12 changes: 12 additions & 0 deletions utils/cmd_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package utils

import (
"os/exec"
"syscall"
)

func SetCmdAttrs(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
}
}

0 comments on commit 7147c40

Please sign in to comment.