version string will now be a real semantic version

This commit is contained in:
sawka 2022-09-24 13:53:19 -07:00
parent aa1542cfc0
commit 4550e18b6b
6 changed files with 13 additions and 9 deletions

12
go.mod
View File

@ -3,9 +3,11 @@ module github.com/scripthaus-dev/mshell
go 1.17 go 1.17
require ( require (
github.com/alessio/shellescape v1.4.1 // indirect github.com/alessio/shellescape v1.4.1
github.com/creack/pty v1.1.18 // indirect github.com/creack/pty v1.1.18
github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/fsnotify/fsnotify v1.5.4
github.com/google/uuid v1.3.0 // indirect github.com/google/uuid v1.3.0
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
) )
require github.com/Masterminds/semver/v3 v3.1.1 // indirect

2
go.sum
View File

@ -1,3 +1,5 @@
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=

View File

@ -499,7 +499,7 @@ func main() {
handleUsage() handleUsage()
return return
} else if firstArg == "--version" { } else if firstArg == "--version" {
fmt.Printf("mshell v%s\n", base.MShellVersion) fmt.Printf("mshell %s\n", base.MShellVersion)
return return
} else if firstArg == "--env" { } else if firstArg == "--env" {
rtnCode, err := handleEnv() rtnCode, err := handleEnv()

View File

@ -28,7 +28,7 @@ const MShellPathVarName = "MSHELL_PATH"
const MShellHomeVarName = "MSHELL_HOME" const MShellHomeVarName = "MSHELL_HOME"
const SSHCommandVarName = "SSH_COMMAND" const SSHCommandVarName = "SSH_COMMAND"
const SessionsDirBaseName = "sessions" const SessionsDirBaseName = "sessions"
const MShellVersion = "0.1.0" const MShellVersion = "v0.1.0"
const RemoteIdFile = "remoteid" const RemoteIdFile = "remoteid"
var sessionDirCache = make(map[string]string) var sessionDirCache = make(map[string]string)

View File

@ -76,7 +76,7 @@ func MakeClientProc(ctx context.Context, ecmd *exec.Cmd) (*ClientProc, string, e
} }
if initPk.Version != base.MShellVersion { if initPk.Version != base.MShellVersion {
cproc.Close() cproc.Close()
return nil, initPk.UName, fmt.Errorf("invalid remote mshell version 'v%s', must be v%s", initPk.Version, base.MShellVersion) return nil, initPk.UName, fmt.Errorf("invalid remote mshell version '%s', must be %s", initPk.Version, base.MShellVersion)
} }
cproc.InitPk = initPk cproc.InitPk = initPk
} }

View File

@ -779,7 +779,7 @@ func RunClientSSHCommandAndWait(runPacket *packet.RunPacketType, fdContext FdCon
return nil, fmt.Errorf("mshell command not found on remote server, can install with 'mshell --install %s %s.%s'", sshOptsStr, goos, goarch) return nil, fmt.Errorf("mshell command not found on remote server, can install with 'mshell --install %s %s.%s'", sshOptsStr, goos, goarch)
} }
if initPk.Version != base.MShellVersion { if initPk.Version != base.MShellVersion {
return nil, fmt.Errorf("invalid remote mshell version 'v%s', must be v%s", initPk.Version, base.MShellVersion) return nil, fmt.Errorf("invalid remote mshell version '%s', must be %s", initPk.Version, base.MShellVersion)
} }
versionOk = true versionOk = true
if debug { if debug {