From 70be0b8f8fbe0f86d1553a49d301a5562c37eb49 Mon Sep 17 00:00:00 2001 From: Christopher Blaha Date: Wed, 3 Aug 2022 11:41:38 -0400 Subject: [PATCH 1/4] changed the path in mac data --- netclient/ncutils/netclientutils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netclient/ncutils/netclientutils.go b/netclient/ncutils/netclientutils.go index 72a4bb72..928cc1bf 100644 --- a/netclient/ncutils/netclientutils.go +++ b/netclient/ncutils/netclientutils.go @@ -42,7 +42,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/Applications\\ Support/Netclient" // WINDOWS_APP_DATA_PATH - windows path const WINDOWS_APP_DATA_PATH = "C:\\Program Files (x86)\\Netclient" From 35ae2bf1312cfd99b07aa384ffa39baba83019f7 Mon Sep 17 00:00:00 2001 From: Christopher Blaha Date: Wed, 3 Aug 2022 11:45:18 -0400 Subject: [PATCH 2/4] Application not Applications --- netclient/ncutils/netclientutils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netclient/ncutils/netclientutils.go b/netclient/ncutils/netclientutils.go index 928cc1bf..13b25963 100644 --- a/netclient/ncutils/netclientutils.go +++ b/netclient/ncutils/netclientutils.go @@ -42,7 +42,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/Applications\\ Support/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" From 6c43466141d8fb643ad7cdf81e6481510041910a Mon Sep 17 00:00:00 2001 From: Christopher Blaha Date: Mon, 8 Aug 2022 21:31:29 -0400 Subject: [PATCH 3/4] trying without the / --- netclient/ncutils/netclientutils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netclient/ncutils/netclientutils.go b/netclient/ncutils/netclientutils.go index 13b25963..78b0ced3 100644 --- a/netclient/ncutils/netclientutils.go +++ b/netclient/ncutils/netclientutils.go @@ -42,7 +42,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 = "/Library/Application Support/Netclient" // WINDOWS_APP_DATA_PATH - windows path const WINDOWS_APP_DATA_PATH = "C:\\Program Files (x86)\\Netclient" From 334c579a2edc423ae9857eccc689f60d4cd4b3cd Mon Sep 17 00:00:00 2001 From: theguy951357 Date: Thu, 11 Aug 2022 16:22:19 -0400 Subject: [PATCH 4/4] upgrade logic for moving Netclient data folder --- netclient/functions/upgrades/upgrades.go | 2 +- netclient/functions/upgrades/v0-14-7.go | 41 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 netclient/functions/upgrades/v0-14-7.go 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") +}