mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
add buildtime to initpacket
This commit is contained in:
+3
-2
@@ -22,7 +22,7 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
var BuildTime = "-"
|
||||
var BuildTime = "0"
|
||||
|
||||
// func doMainRun(pk *packet.RunPacketType, sender *packet.PacketSender) {
|
||||
// err := shexec.ValidateRunPacket(pk)
|
||||
@@ -533,6 +533,7 @@ Examples:
|
||||
}
|
||||
|
||||
func main() {
|
||||
base.SetBuildTime(BuildTime)
|
||||
if len(os.Args) == 1 {
|
||||
handleUsage()
|
||||
return
|
||||
@@ -542,7 +543,7 @@ func main() {
|
||||
handleUsage()
|
||||
return
|
||||
} else if firstArg == "--version" {
|
||||
fmt.Printf("mshell %s\n", base.MShellVersion)
|
||||
fmt.Printf("mshell %s+%s\n", base.MShellVersion, base.BuildTime)
|
||||
return
|
||||
} else if firstArg == "--test-env" {
|
||||
state, err := shexec.GetShellState()
|
||||
|
||||
@@ -41,6 +41,7 @@ var sessionDirCache = make(map[string]string)
|
||||
var baseLock = &sync.Mutex{}
|
||||
var DebugLogEnabled = false
|
||||
var DebugLogger *log.Logger
|
||||
var BuildTime string = "0"
|
||||
|
||||
type CommandFileNames struct {
|
||||
PtyOutFile string
|
||||
@@ -50,6 +51,10 @@ type CommandFileNames struct {
|
||||
|
||||
type CommandKey string
|
||||
|
||||
func SetBuildTime(build string) {
|
||||
BuildTime = build
|
||||
}
|
||||
|
||||
func MakeCommandKey(sessionId string, cmdId string) CommandKey {
|
||||
if sessionId == "" && cmdId == "" {
|
||||
return CommandKey("")
|
||||
|
||||
@@ -461,6 +461,7 @@ type InitPacketType struct {
|
||||
Type string `json:"type"`
|
||||
RespId string `json:"respid,omitempty"`
|
||||
Version string `json:"version"`
|
||||
BuildTime string `json:"buildtime,omitempty"`
|
||||
MShellHomeDir string `json:"mshellhomedir,omitempty"`
|
||||
HomeDir string `json:"homedir,omitempty"`
|
||||
State *ShellState `json:"state,omitempty"`
|
||||
|
||||
@@ -1405,6 +1405,7 @@ func (c *ShExecType) WaitForCommand() *packet.CmdDonePacketType {
|
||||
func MakeInitPacket() *packet.InitPacketType {
|
||||
initPacket := packet.MakeInitPacket()
|
||||
initPacket.Version = base.MShellVersion
|
||||
initPacket.BuildTime = base.BuildTime
|
||||
initPacket.HomeDir = base.GetHomeDir()
|
||||
initPacket.MShellHomeDir = base.GetMShellHomeDir()
|
||||
if user, _ := user.Current(); user != nil {
|
||||
|
||||
Reference in New Issue
Block a user