diff --git a/VERSION b/VERSION index 781dcb0..65087b4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.3 +1.1.4 diff --git a/cmd/collect/main.go b/cmd/collect/main.go index 75cc61d..c38055a 100644 --- a/cmd/collect/main.go +++ b/cmd/collect/main.go @@ -75,9 +75,13 @@ func main() { machtype := flag.String("machtype", "", "$MACHTYPE") gitCdup := flag.String("gitCdup", "", "git rev-parse --show-cdup") gitRemote := flag.String("gitRemote", "", "git remote get-url origin") + gitCdupAfter := flag.String("gitCdupAfter", "", "git rev-parse --show-cdup") + gitRemoteAfter := flag.String("gitRemoteAfter", "", "git remote get-url origin") gitCdupExitCode := flag.Int("gitCdupExitCode", -1, "... $?") gitRemoteExitCode := flag.Int("gitRemoteExitCode", -1, "... $?") + gitCdupExitCodeAfter := flag.Int("gitCdupExitCodeAfter", -1, "... $?") + gitRemoteExitCodeAfter := flag.Int("gitRemoteExitCodeAfter", -1, "... $?") // before after timezoneBefore := flag.String("timezoneBefore", "", "") @@ -161,6 +165,10 @@ func main() { if *gitRemoteExitCode != 0 { *gitRemote = "" } + gitDirAfter, gitRealDirAfter := getGitDirs(*gitCdupAfter, *gitCdupExitCodeAfter, *pwd) + if *gitRemoteExitCodeAfter != 0 { + *gitRemoteAfter = "" + } if *osReleaseID == "" { *osReleaseID = "linux" @@ -219,10 +227,13 @@ func main() { RealtimeSinceSessionStart: realtimeSinceSessionStart, RealtimeSinceBoot: realtimeSinceBoot, - GitDir: gitDir, - GitRealDir: gitRealDir, - GitOriginRemote: *gitRemote, - MachineID: readFileContent(machineIDPath), + GitDir: gitDir, + GitRealDir: gitRealDir, + GitOriginRemote: *gitRemote, + GitDirAfter: gitDirAfter, + GitRealDirAfter: gitRealDirAfter, + GitOriginRemoteAfter: *gitRemoteAfter, + MachineID: readFileContent(machineIDPath), OsReleaseID: *osReleaseID, OsReleaseVersionID: *osReleaseVersionID, diff --git a/cmd/daemon/main.go b/cmd/daemon/main.go index 9411350..91d1e28 100644 --- a/cmd/daemon/main.go +++ b/cmd/daemon/main.go @@ -126,6 +126,7 @@ func (h *recordHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func runServer(port int, outputPath string) { http.HandleFunc("/status", statusHandler) http.Handle("/record", &recordHandler{OutputPath: outputPath}) + //http.Handle("/session_start", &recordHandler{OutputPath: outputPath}) http.ListenAndServe(":"+strconv.Itoa(port), nil) } diff --git a/pkg/records/records.go b/pkg/records/records.go index f15c717..8a5216b 100644 --- a/pkg/records/records.go +++ b/pkg/records/records.go @@ -56,10 +56,13 @@ type BaseRecord struct { RealtimeSinceBoot float64 `json:"realtimeSinceBoot"` //Logs []string `json: "logs"` - GitDir string `json:"gitDir"` - GitRealDir string `json:"gitRealDir"` - GitOriginRemote string `json:"gitOriginRemote"` - MachineID string `json:"machineId"` + GitDir string `json:"gitDir"` + GitRealDir string `json:"gitRealDir"` + GitOriginRemote string `json:"gitOriginRemote"` + GitDirAfter string `json:"gitDirAfter"` + GitRealDirAfter string `json:"gitRealDirAfter"` + GitOriginRemoteAfter string `json:"gitOriginRemoteAfter"` + MachineID string `json:"machineId"` OsReleaseID string `json:"osReleaseId"` OsReleaseVersionID string `json:"osReleaseVersionId"` diff --git a/scripts/shellrc.sh b/scripts/shellrc.sh index acdbeeb..c9804fe 100644 --- a/scripts/shellrc.sh +++ b/scripts/shellrc.sh @@ -43,6 +43,10 @@ __resh_run_daemon() { nohup resh-daemon &>/dev/null & disown } +# __resh_session_init() { +# resh-event session_start --sessionId "$__RESH_SESSION_ID" --sessionPid "$__RESH_SESSION_PID" +# } +# __resh_bash_completion_init() { local bash_completion_dir=~/.resh/bash_completion.d # source user completion directory definitions @@ -95,6 +99,7 @@ if [ -z "${__RESH_SESSION_ID+x}" ]; then export __RESH_SESSION_ID; __RESH_SESSION_ID=$(__resh_get_uuid) export __RESH_SESSION_PID="$$" # TODO add sesson time + # __resh_session_init __RESH_SESSION_ID __RESH_SESSION_PID fi # posix @@ -178,6 +183,10 @@ __resh_precmd() { __RESH_RT_AFTER=$(__resh_get_epochrealtime) __RESH_TZ_AFTER=$(date +%z) __RESH_PWD_AFTER="$PWD" + __RESH_GIT_CDUP_AFTER="$(git rev-parse --show-cdup 2>/dev/null)" + __RESH_GIT_CDUP_EXIT_CODE_AFTER=$? + __RESH_GIT_REMOTE_AFTER="$(git remote get-url origin 2>/dev/null)" + __RESH_GIT_REMOTE_EXIT_CODE_AFTER=$? if [ -n "${__RESH_COLLECT}" ]; then if [ "$__RESH_VERSION" != "$(resh-collect -version)" ]; then # shellcheck source=shellrc.sh @@ -223,6 +232,10 @@ __resh_precmd() { -gitCdupExitCode "$__RESH_GIT_CDUP_EXIT_CODE" \ -gitRemote "$__RESH_GIT_REMOTE" \ -gitRemoteExitCode "$__RESH_GIT_REMOTE_EXIT_CODE" \ + -gitCdupAfter "$__RESH_GIT_CDUP_AFTER" \ + -gitCdupExitCodeAfter "$__RESH_GIT_CDUP_EXIT_CODE_AFTER" \ + -gitRemoteAfter "$__RESH_GIT_REMOTE_AFTER" \ + -gitRemoteExitCodeAfter "$__RESH_GIT_REMOTE_EXIT_CODE_AFTER" \ -realtimeBefore "$__RESH_RT_BEFORE" \ -realtimeAfter "$__RESH_RT_AFTER" \ -realtimeSession "$__RESH_RT_SESSION" \