From a1f6632d8f87b20938fa80a1d3ece5f3a739e92c Mon Sep 17 00:00:00 2001 From: Simon Let Date: Mon, 10 Jun 2019 16:47:08 +0200 Subject: [PATCH] better version checking bump version to 1.1.1 --- Makefile | 6 +-- collect/resh-collect.go | 4 +- shellrc.sh | 88 ++++++++++++++++++++++------------------- version | 2 +- 4 files changed, 53 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 39ed220..6a31ce0 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ autoinstall: build: submodules resh-collect resh-daemon -install: build | $(HOME)/.resh $(HOME)/.resh/bin $(HOME)/.config $(HOME)/.resh/resh-uuid +install: build submodules/bash-preexec/bash-preexec.sh shellrc.sh config.toml uuid.sh | $(HOME)/.resh $(HOME)/.resh/bin $(HOME)/.config # Copying files to resh directory ... cp -f submodules/bash-preexec/bash-preexec.sh ~/.bash-preexec.sh cp -f config.toml ~/.config/resh.toml @@ -55,10 +55,10 @@ uninstall: # Uninstalling ... -rm -rf ~/.resh/ -resh-daemon: daemon/resh-daemon.go common/resh-common.go +resh-daemon: daemon/resh-daemon.go common/resh-common.go version go build ${GOFLAGS} -o $@ $< -resh-collect: collect/resh-collect.go common/resh-common.go +resh-collect: collect/resh-collect.go common/resh-common.go version go build ${GOFLAGS} -o $@ $< diff --git a/collect/resh-collect.go b/collect/resh-collect.go index 7849d17..ae52923 100644 --- a/collect/resh-collect.go +++ b/collect/resh-collect.go @@ -106,14 +106,14 @@ func main() { if *requireVersion != "" && *requireVersion != Version { fmt.Println("Please restart/reload this terminal session " + "(resh version: " + Version + - " resh version of this terminal session: " + *requireVersion + + "; resh version of this terminal session: " + *requireVersion + ")") os.Exit(3) } if *requireRevision != "" && *requireRevision != Revision { fmt.Println("Please restart/reload this terminal session " + "(resh revision: " + Revision + - " resh revision of this terminal session: " + *requireRevision + + "; resh revision of this terminal session: " + *requireRevision + ")") os.Exit(3) } diff --git a/shellrc.sh b/shellrc.sh index 613348d..3bcefb9 100644 --- a/shellrc.sh +++ b/shellrc.sh @@ -152,47 +152,53 @@ __resh_precmd() { __RESH_TZ_AFTER=$(date +%z) __RESH_PWD_AFTER="$PWD" if [ -n "${__RESH_COLLECT}" ]; then - resh-collect -requireVersion "$__RESH_VERSION" \ - -requireRevision "$__RESH_REVISION" \ - -cmdLine "$__RESH_CMDLINE" \ - -exitCode "$__RESH_EXIT_CODE" \ - -shell "$__RESH_SHELL" \ - -uname "$__RESH_UNAME" \ - -sessionId "$__RESH_SESSION_ID" \ - -cols "$__RESH_COLS" \ - -home "$__RESH_HOME" \ - -lang "$__RESH_LANG" \ - -lcAll "$__RESH_LC_ALL" \ - -lines "$__RESH_LINES" \ - -login "$__RESH_LOGIN" \ - -pwd "$__RESH_PWD" \ - -pwdAfter "$__RESH_PWD_AFTER" \ - -shellEnv "$__RESH_SHELL_ENV" \ - -term "$__RESH_TERM" \ - -pid "$__RESH_PID" \ - -sessionPid "$__RESH_SESSION_PID" \ - -host "$__RESH_HOST" \ - -hosttype "$__RESH_HOSTTYPE" \ - -ostype "$__RESH_OSTYPE" \ - -machtype "$__RESH_MACHTYPE" \ - -shlvl "$__RESH_SHLVL" \ - -gitCdup "$__RESH_GIT_CDUP" \ - -gitCdupExitCode "$__RESH_GIT_CDUP_EXIT_CODE" \ - -gitRemote "$__RESH_GIT_REMOTE" \ - -gitRemoteExitCode "$__RESH_GIT_REMOTE_EXIT_CODE" \ - -realtimeBefore "$__RESH_RT_BEFORE" \ - -realtimeAfter "$__RESH_RT_AFTER" \ - -realtimeSession "$__RESH_RT_SESSION" \ - -realtimeSessSinceBoot "$__RESH_RT_SESS_SINCE_BOOT" \ - -timezoneBefore "$__RESH_TZ_BEFORE" \ - -timezoneAfter "$__RESH_TZ_AFTER" \ - -osReleaseId "$__RESH_OS_RELEASE_ID" \ - -osReleaseVersionId "$__RESH_OS_RELEASE_VERSION_ID" \ - -osReleaseIdLike "$__RESH_OS_RELEASE_ID_LIKE" \ - -osReleaseName "$__RESH_OS_RELEASE_NAME" \ - -osReleasePrettyName "$__RESH_OS_RELEASE_PRETTY_NAME" \ - &>~/.resh/client_last_run_out.txt || echo "resh ERROR: $(head -n 1 ~/.resh/client_last_run_out.txt)" - # -path "$__RESH_PATH" \ + if [ "$__RESH_VERSION" != $(resh-collect -version) ]; then + echo "resh WARNING: You probably just updated RESH - please restart/reload this terminal session (resh version: $(resh-collect -version); resh version of this terminal session: ${__RESH_VERSION})" + elif [ "$__RESH_REVISION" != $(resh-collect -revision) ]; then + echo "resh WARNING: You probably just updated RESH - please restart/reload this terminal session (resh version: $(resh-collect -revision); resh version of this terminal session: ${__RESH_REVISION})" + else + resh-collect -requireVersion "$__RESH_VERSION" \ + -requireRevision "$__RESH_REVISION" \ + -cmdLine "$__RESH_CMDLINE" \ + -exitCode "$__RESH_EXIT_CODE" \ + -shell "$__RESH_SHELL" \ + -uname "$__RESH_UNAME" \ + -sessionId "$__RESH_SESSION_ID" \ + -cols "$__RESH_COLS" \ + -home "$__RESH_HOME" \ + -lang "$__RESH_LANG" \ + -lcAll "$__RESH_LC_ALL" \ + -lines "$__RESH_LINES" \ + -login "$__RESH_LOGIN" \ + -pwd "$__RESH_PWD" \ + -pwdAfter "$__RESH_PWD_AFTER" \ + -shellEnv "$__RESH_SHELL_ENV" \ + -term "$__RESH_TERM" \ + -pid "$__RESH_PID" \ + -sessionPid "$__RESH_SESSION_PID" \ + -host "$__RESH_HOST" \ + -hosttype "$__RESH_HOSTTYPE" \ + -ostype "$__RESH_OSTYPE" \ + -machtype "$__RESH_MACHTYPE" \ + -shlvl "$__RESH_SHLVL" \ + -gitCdup "$__RESH_GIT_CDUP" \ + -gitCdupExitCode "$__RESH_GIT_CDUP_EXIT_CODE" \ + -gitRemote "$__RESH_GIT_REMOTE" \ + -gitRemoteExitCode "$__RESH_GIT_REMOTE_EXIT_CODE" \ + -realtimeBefore "$__RESH_RT_BEFORE" \ + -realtimeAfter "$__RESH_RT_AFTER" \ + -realtimeSession "$__RESH_RT_SESSION" \ + -realtimeSessSinceBoot "$__RESH_RT_SESS_SINCE_BOOT" \ + -timezoneBefore "$__RESH_TZ_BEFORE" \ + -timezoneAfter "$__RESH_TZ_AFTER" \ + -osReleaseId "$__RESH_OS_RELEASE_ID" \ + -osReleaseVersionId "$__RESH_OS_RELEASE_VERSION_ID" \ + -osReleaseIdLike "$__RESH_OS_RELEASE_ID_LIKE" \ + -osReleaseName "$__RESH_OS_RELEASE_NAME" \ + -osReleasePrettyName "$__RESH_OS_RELEASE_PRETTY_NAME" \ + &>~/.resh/client_last_run_out.txt || echo "resh ERROR: $(head -n 1 ~/.resh/client_last_run_out.txt)" + # -path "$__RESH_PATH" \ + fi fi unset __RESH_COLLECT } diff --git a/version b/version index 9084fa2..524cb55 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.1.0 +1.1.1