From 7dd313add08cb25888521884c33c3de93728852e Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 30 May 2024 22:57:05 -0400 Subject: [PATCH] Save server EntryRoot and OS type during init, use to progress toward Windows server support --- libmuttonserver.go | 3 +++ src/cli/init.go | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libmuttonserver.go b/libmuttonserver.go index 88190a8..616335b 100644 --- a/libmuttonserver.go +++ b/libmuttonserver.go @@ -6,6 +6,7 @@ import ( "github.com/rwinkhart/MUTN/src/cli" "github.com/rwinkhart/MUTN/src/sync" "os" + "strconv" "strings" ) @@ -30,6 +31,8 @@ func main() { case "register": // register a new device ID os.Create(backend.ConfigDir + backend.PathSeparator + "devices" + backend.PathSeparator + args[2]) + // print EntryRoot and bool indicating OS type to stdout for client to store in config + fmt.Print(backend.EntryRoot + "\x1d" + strconv.FormatBool(backend.IsWindows)) case "init": // create the necessary directories for libmuttonserver to function backend.DirInit() diff --git a/src/cli/init.go b/src/cli/init.go index d727378..0a3d189 100644 --- a/src/cli/init.go +++ b/src/cli/init.go @@ -43,7 +43,10 @@ func TempInitCli() { backend.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID, "sshUser": sshUser, "sshIP": sshIP, "sshPort": sshPort, "sshKey": sshKey, "sshKeyProtected": strconv.FormatBool(sshKeyProtected)}) // generate device ID - sync.DeviceIDGen() + sshEntryRoot, sshIsWindows := sync.DeviceIDGen() + + // update config file with sshEntryRoot and sshIsWindows TODO append to existing config file + backend.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID, "sshUser": sshUser, "sshIP": sshIP, "sshPort": sshPort, "sshKey": sshKey, "sshKeyProtected": strconv.FormatBool(sshKeyProtected), "sshEntryRoot": sshEntryRoot, "sshIsWindows": sshIsWindows}) } else { // write config file backend.TempInit(map[string]string{"textEditor": textEditor, "gpgID": gpgID})