diff --git a/netclient/functions/upgrades/upgrades.go b/netclient/functions/upgrades/upgrades.go index fd5cf680..5b9b4471 100644 --- a/netclient/functions/upgrades/upgrades.go +++ b/netclient/functions/upgrades/upgrades.go @@ -2,7 +2,7 @@ package upgrades func init() { addUpgrades([]UpgradeInfo{ - upgrade0145, + upgrade0147, }) } diff --git a/netclient/functions/upgrades/v0-14-7.go b/netclient/functions/upgrades/v0-14-7.go new file mode 100644 index 00000000..9424a408 --- /dev/null +++ b/netclient/functions/upgrades/v0-14-7.go @@ -0,0 +1,41 @@ +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{ + RequiredVersions: []string{ + "v0.14.0", + "v0.14.1", + "v0.14.2", + "v0.14.3", + "v0.14.4", + "v0.14.5", + "v0.14.6", + }, + NewVersion: "v0.14.7", + OP: update0147, +} + +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") + } + + } + logger.Log(0, "updating schema for v0.14.7") +} diff --git a/netclient/ncutils/netclientutils.go b/netclient/ncutils/netclientutils.go index 7dc8a1ec..c349b0fe 100644 --- a/netclient/ncutils/netclientutils.go +++ b/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 = "/Applications/Netclient" +const MAC_APP_DATA_PATH = "/Library/Application Support/Netclient" // WINDOWS_APP_DATA_PATH - windows path const WINDOWS_APP_DATA_PATH = "C:\\Program Files (x86)\\Netclient"