diff --git a/bashbot.sh b/bashbot.sh index 22dac24..1a95930 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb # 8 - curl/wget missing # 10 - not bash! # -#### $$VERSION$$ v1.40-dev-31-g9ce139a +#### $$VERSION$$ v1.40-dev-32-gd876f75 ################################################################## # are we running in a terminal? @@ -688,7 +688,10 @@ event_send() { # fallback version, full version is in bin/bashbot_init.in.sh # initialize bot environment, user and permissions bot_init() { - cd "${BASHBOT_HOME}" || printf "Can't change to BASHBOT_HOME" && exit_source 1 + if [ -n "${BASHBOT_HOME}" ] && ! cd "${BASHBOT_HOME}"; then + printf "Can't change to BASHBOT_HOME" + exit 1 + fi # initialize addons printf "Initialize addons ...\n" for addons in "${ADDONDIR:-.}"/*.sh ; do diff --git a/bin/bashbot_init.inc.sh b/bin/bashbot_init.inc.sh index c0a3f39..3a16f39 100644 --- a/bin/bashbot_init.inc.sh +++ b/bin/bashbot_init.inc.sh @@ -11,7 +11,7 @@ # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 27.01.2021 13:42 # -#### $$VERSION$$ v1.35-dev-29-g0c0dc01 +#### $$VERSION$$ v1.40-dev-32-gd876f75 #=============================================================================== # shellcheck disable=SC2059 @@ -38,7 +38,10 @@ my_init() { # # delete from here to disable extended initialisation bot_init() { - [ -n "${BASHBOT_HOME}" ] && cd "${BASHBOT_HOME}" || exit 1 + if [ -n "${BASHBOT_HOME}" ] && ! cd "${BASHBOT_HOME}"; then + printf "Can't change to BASHBOT_HOME" + exit 1 + fi local runuser chown touser botname DEBUG="$1" # upgrade from old version # currently no action diff --git a/bin/process_update.sh b/bin/process_update.sh index 34385fb..27bb3a4 100755 --- a/bin/process_update.sh +++ b/bin/process_update.sh @@ -15,7 +15,7 @@ USAGE='process_update.sh [-h|--help] [debug] [/dev/null)" # assign to bashbot ARRAY