diff options
author | kali <kali@leap.se> | 2020-09-30 16:25:27 +0200 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2020-10-13 19:08:44 +0200 |
commit | ef892643df8970aec45dbc3f48eabb95a1ccbf22 (patch) | |
tree | 1a20c34cca7b94e69468e471790996fa61909805 /pkg/helper/darwin.go | |
parent | 47ac0543b9ed2d4afb8814a19e2f4dc3c30030e1 (diff) |
[pkg] osx helper and working qt installer
Diffstat (limited to 'pkg/helper/darwin.go')
-rw-r--r-- | pkg/helper/darwin.go | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/pkg/helper/darwin.go b/pkg/helper/darwin.go index ae42646..2210da3 100644 --- a/pkg/helper/darwin.go +++ b/pkg/helper/darwin.go @@ -50,24 +50,23 @@ const ( func _getExecPath() string { ex, err := os.Executable() if err != nil { - log.Print("error while getting executable path!") + log.Print("ERROR: cannot find executable path") } return filepath.Dir(ex) } -func getHelperPath() string { - execPath := _getExecPath() - hp := filepath.Join(execPath, "../../../", "bitmask-helper") - log.Println(">>> DEBUG: helper", hp) - return hp +func getHelperDir() string { + d := _getExecPath() + log.Println(">>> DEBUG: helper dir", d) + return d } func getPlatformOpenvpnFlags() []string { - helperPath := getHelperPath() + helperDir := getHelperDir() return []string{ "--script-security", "2", - "--up", helperPath + "client.up.sh", - "--down", helperPath + "client.down.sh", + "--up", filepath.Join(helperDir, "client.up.sh"), + "--down", filepath.Join(helperDir, "client.down.sh"), } } @@ -83,7 +82,7 @@ func daemonize() { PidFilePerm: 0644, LogFileName: "bitmask-helper.log", LogFilePerm: 0640, - WorkDir: "./", + WorkDir: filepath.Join(getHelperDir(), "helper"), Umask: 027, Args: []string{"[bitmask-helper]"}, } @@ -107,8 +106,7 @@ func runServer(preferredPort int) { } func getOpenvpnPath() string { - execPath := _getExecPath() - openvpnPath := filepath.Join(execPath, "../../../", "openvpn.leap") + openvpnPath := filepath.Join(getHelperDir(), "openvpn.leap") log.Println(">>> DEBUG: openvpn", openvpnPath) return openvpnPath } @@ -203,7 +201,7 @@ func loadBitmaskAnchor() error { } func getRulefilePath() (string, error) { - rulefilePath := filepath.Join(getHelperPath(), "helper", "bitmask.pf.conf") + rulefilePath := filepath.Join(getHelperDir(), "helper", "bitmask.pf.conf") log.Println("DEBUG: rule file path", rulefilePath) if _, err := os.Stat(rulefilePath); !os.IsNotExist(err) { |