@@ -35,6 +35,7 @@ import (
3535 "github.com/shirou/gopsutil/v3/cpu"
3636 "github.com/shirou/gopsutil/v3/disk"
3737 psHost "github.com/shirou/gopsutil/v3/host"
38+ nats "github.com/nats-io/nats.go"
3839 "github.com/spf13/viper"
3940 trmm "github.com/wh1te909/trmm-shared"
4041 "golang.org/x/text/cases"
@@ -165,6 +166,7 @@ func NewAgentConfig() *rmm.AgentConfig {
165166 NatsStandardPort : viper .GetString ("natsstandardport" ),
166167 NatsPingInterval : viper .GetInt ("natspinginterval" ),
167168 Insecure : viper .GetString ("insecure" ),
169+ UnixTmpDir : viper .GetString ("tmpdir" ),
168170 }
169171 return ret
170172}
@@ -173,7 +175,7 @@ func (a *Agent) RunScript(code string, shell string, args []string, timeout int,
173175 code = removeWinNewLines (code )
174176 content := []byte (code )
175177
176- f , err := createNixTmpFile (shell )
178+ f , err := createNixTmpFile (a . UnixTmpDir , shell )
177179 if err != nil {
178180 a .Logger .Errorln ("RunScript createNixTmpFile()" , err )
179181 return "" , err .Error (), 85 , err
@@ -368,7 +370,7 @@ func (a *Agent) AgentUpdate(url, inno, version string) error {
368370}
369371
370372func (a * Agent ) AgentUninstall (code string ) {
371- f , err := createNixTmpFile ()
373+ f , err := createNixTmpFile (a . UnixTmpDir )
372374 if err != nil {
373375 a .Logger .Errorln ("AgentUninstall createNixTmpFile():" , err )
374376 return
@@ -665,20 +667,20 @@ func (a *Agent) InstallNushell(force bool) {
665667 case "darwin" :
666668 switch runtime .GOARCH {
667669 case "arm64" :
668- // https://github.com/nushell/nushell/releases/download/0.87.0 /nu-0.87.0 -aarch64-darwin-full .tar.gz
669- assetName = fmt .Sprintf ("nu-%s-aarch64-darwin-full .tar.gz" , conf .InstallNushellVersion )
670+ // https://github.com/nushell/nushell/releases/download/0.106.1 /nu-0.106.1 -aarch64-apple-darwin .tar.gz
671+ assetName = fmt .Sprintf ("nu-%s-aarch64-apple-darwin .tar.gz" , conf .InstallNushellVersion )
670672 default :
671673 a .Logger .Debugln ("InstallNushell(): Unsupported architecture and OS:" , runtime .GOARCH , runtime .GOOS )
672674 return
673675 }
674676 case "linux" :
675677 switch runtime .GOARCH {
676678 case "amd64" :
677- // https://github.com/nushell/nushell/releases/download/0.87.0 /nu-0.87.0 -x86_64-linux-musl-full .tar.gz
678- assetName = fmt .Sprintf ("nu-%s-x86_64-linux-musl-full .tar.gz" , conf .InstallNushellVersion )
679+ // https://github.com/nushell/nushell/releases/download/0.106.1 /nu-0.106.1 -x86_64-unknown- linux-musl.tar.gz
680+ assetName = fmt .Sprintf ("nu-%s-x86_64-unknown- linux-musl.tar.gz" , conf .InstallNushellVersion )
679681 case "arm64" :
680- // https://github.com/nushell/nushell/releases/download/0.87.0 /nu-0.87.0 -aarch64-linux-gnu-full .tar.gz
681- assetName = fmt .Sprintf ("nu-%s-aarch64-linux-gnu-full .tar.gz" , conf .InstallNushellVersion )
682+ // https://github.com/nushell/nushell/releases/download/0.106.1 /nu-0.106.1 -aarch64-unknown- linux-musl .tar.gz
683+ assetName = fmt .Sprintf ("nu-%s-aarch64-unknown- linux-musl .tar.gz" , conf .InstallNushellVersion )
682684 default :
683685 a .Logger .Debugln ("InstallNushell(): Unsupported architecture and OS:" , runtime .GOARCH , runtime .GOOS )
684686 return
@@ -953,10 +955,42 @@ func (a *Agent) installMesh(meshbin, exe, proxy string) (string, error) {
953955 return "not implemented" , nil
954956}
955957
956- func CMDShell (shell string , cmdArgs []string , command string , timeout int , detached bool , runasuser bool ) (output [2 ]string , e error ) {
958+ func CMDShell (shell string , cmdArgs []string , command string , timeout int , detached bool , runasuser bool , stream bool , agentID * string , cmdID * string , nc * nats. Conn ) (output [2 ]string , e error ) {
957959 return [2 ]string {"" , "" }, nil
958960}
959961
962+ func BrowseRegistry (path string , page int , pageSize int ) ([]map [string ]interface {}, []map [string ]interface {}, bool , error ) {
963+ return nil , nil , false , errors .New ("registry access is only supported on Windows" )
964+ }
965+
966+ func CreateRegistryKey (path string ) error {
967+ return errors .New ("registry key creation is only supported on Windows" )
968+ }
969+
970+ func DeleteRegistryKey (path string ) error {
971+ return errors .New ("deleting registry keys is only supported on Windows" )
972+ }
973+
974+ func RenameRegistryKey (oldPath , newPath string ) error {
975+ return errors .New ("renaming registry keys is only supported on Windows" )
976+ }
977+
978+ func CreateRegistryValue (path string , name string , valType string , data interface {}) (map [string ]interface {}, error ) {
979+ return nil , errors .New ("creating registry values is only supported on Windows" )
980+ }
981+
982+ func DeleteRegistryValue (path string , name string ) error {
983+ return errors .New ("deleting registry values is only supported on Windows" )
984+ }
985+
986+ func RenameRegistryValue (path , oldName , newName string ) (string , error ) {
987+ return "" , errors .New ("renaming registry values is only supported on Windows" )
988+ }
989+
990+ func ModifyRegistryValue (path string , name string , valType string , data interface {}) (map [string ]interface {}, error ) {
991+ return nil , errors .New ("modifying registry values is only supported on Windows" )
992+ }
993+
960994func CMD (exe string , args []string , timeout int , detached bool ) (output [2 ]string , e error ) {
961995 return [2 ]string {"" , "" }, nil
962996}
0 commit comments