Implement initial server-side shearing logic

This commit is contained in:
2024-05-16 16:35:05 -04:00
parent 278c2c1fe4
commit 56e8dc613a
10 changed files with 87 additions and 30 deletions
-1
View File
@@ -50,4 +50,3 @@ func ReadConfig(readKeys []string, missingValueError string) []string {
// sshPort = <remote ssh port>
// sshIdentity = <ssh private key identity file path>
// netPinEnabled = <true/false>
// deviceID = <device id>
+2 -2
View File
@@ -18,8 +18,8 @@ func dirInit() {
os.Exit(1)
}
// create config directory
err = os.MkdirAll(ConfigDir, 0700)
// create config directory w/devices subdirectory
err = os.MkdirAll(ConfigDir+"/devices", 0700)
if err != nil {
fmt.Println(AnsiError + "Failed to create \"" + ConfigDir + "\":" + err.Error() + AnsiReset)
os.Exit(1)
+1
View File
@@ -17,6 +17,7 @@ func dirInit() {
fmt.Println(AnsiError + "Failed to create \"" + EntryRoot + "\":" + err.Error() + AnsiReset)
os.Exit(1)
}
os.MkdirAll(ConfigDir+"\\devices", 0700)
}
// textEditorFallback returns FallbackEditor
-17
View File
@@ -1,17 +0,0 @@
package backend
import (
"fmt"
"os"
)
func Shear(targetLocation string) {
// TODO If in online mode, remove from server and add to shear list
TargetIsFile(targetLocation, true, 0) // needed because os.RemoveAll does not return an error if target does not exist
err := os.RemoveAll(targetLocation)
if err != nil {
fmt.Println(AnsiError + "Failed to remove target: " + err.Error() + AnsiReset)
os.Exit(1)
}
os.Exit(0)
}