afeiszli преди 3 години
родител
ревизия
72060bc587
променени са 3 файла, в които са добавени 17 реда и са изтрити 19 реда
  1. 12 14
      netclient/functions/upgrades/v0-14-7.go
  2. 1 1
      netclient/ncutils/netclientutils.go
  3. 4 4
      netclient/wireguard/mac.go

+ 12 - 14
netclient/functions/upgrades/v0-14-7.go

@@ -1,12 +1,8 @@
 package upgrades
 
 import (
-	"os"
-	"runtime"
-
 	"github.com/gravitl/netmaker/logger"
 	"github.com/gravitl/netmaker/netclient/config"
-	"github.com/gravitl/netmaker/netclient/ncutils"
 )
 
 var upgrade0147 = UpgradeInfo{
@@ -26,16 +22,18 @@ var upgrade0147 = UpgradeInfo{
 func update0147(cfg *config.ClientConfig) {
 	//do stuff for 14.X -> 14.6
 	// No-op
-	if runtime.GOARCH == "darwin" {
-		oldLocation := "/Applications/Netclient"
-		newLocation := ncutils.MAC_APP_DATA_PATH
-		err := os.Rename(oldLocation, newLocation)
-		if err != nil {
-			logger.FatalLog("There was an issue moving the Netclient file from Applications to Application Support:", err.Error())
-		} else {
-			logger.Log(0, "The Netclient data file has been moved from Applications to Application Support")
-		}
+	/*
+		if runtime.GOARCH == "darwin" {
+			oldLocation := "/Applications/Netclient"
+			newLocation := ncutils.MAC_APP_DATA_PATH
+			err := os.Rename(oldLocation, newLocation)
+			if err != nil {
+				logger.FatalLog("There was an issue moving the Netclient file from Applications to Application Support:", err.Error())
+			} else {
+				logger.Log(0, "The Netclient data file has been moved from Applications to Application Support")
+			}
 
-	}
+		}
+	*/
 	logger.Log(0, "updating schema for v0.14.7")
 }

+ 1 - 1
netclient/ncutils/netclientutils.go

@@ -43,7 +43,7 @@ const NO_DB_RECORDS = "could not find any records"
 const LINUX_APP_DATA_PATH = "/etc/netclient"
 
 // MAC_APP_DATA_PATH - linux path
-const MAC_APP_DATA_PATH = "/Library/Application Support/Netclient"
+const MAC_APP_DATA_PATH = "/Applications/Netclient"
 
 // WINDOWS_APP_DATA_PATH - windows path
 const WINDOWS_APP_DATA_PATH = "C:\\Program Files (x86)\\Netclient"

+ 4 - 4
netclient/wireguard/mac.go

@@ -209,8 +209,8 @@ func addRoute(addr string, iface string) error {
 // setConfig - sets configuration of the wireguard interface from the config file
 func setConfig(realIface string, confPath string) error {
 	confString := getConfig(confPath)
-	pathFormatted := strings.Replace(confPath, " ", "\\ ", -1)
-	err := os.WriteFile(pathFormatted+".tmp", []byte(confString), 0600)
+	// pathFormatted := strings.Replace(confPath, " ", "\\ ", -1)
+	err := os.WriteFile(confPath+".tmp", []byte(confString), 0600)
 	if err != nil {
 		return err
 	}
@@ -221,9 +221,9 @@ func setConfig(realIface string, confPath string) error {
 
 // getConfig - gets config from config file and strips out incompatible fields
 func getConfig(path string) string {
-	pathFormatted := strings.Replace(path, " ", "\\ ", -1)
+	//pathFormatted := strings.Replace(path, " ", "\\ ", -1)
 	var confCmd = "grep -v -e Address -e MTU -e PostUp -e PostDown "
-	confRaw, _ := ncutils.RunCmd(confCmd+pathFormatted, false)
+	confRaw, _ := ncutils.RunCmd(confCmd+path, false)
 	return confRaw
 }