webhook: fix some glitches

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-02-01 19:37:24 +01:00
parent d876f758ee
commit 969c7a9fbb
3 changed files with 12 additions and 6 deletions

View File

@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb
# 8 - curl/wget missing # 8 - curl/wget missing
# 10 - not bash! # 10 - not bash!
# #
#### $$VERSION$$ v1.40-dev-31-g9ce139a #### $$VERSION$$ v1.40-dev-32-gd876f75
################################################################## ##################################################################
# are we running in a terminal? # are we running in a terminal?
@ -688,7 +688,10 @@ event_send() {
# fallback version, full version is in bin/bashbot_init.in.sh # fallback version, full version is in bin/bashbot_init.in.sh
# initialize bot environment, user and permissions # initialize bot environment, user and permissions
bot_init() { 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 # initialize addons
printf "Initialize addons ...\n" printf "Initialize addons ...\n"
for addons in "${ADDONDIR:-.}"/*.sh ; do for addons in "${ADDONDIR:-.}"/*.sh ; do

View File

@ -11,7 +11,7 @@
# AUTHOR: KayM (gnadelwartz), kay@rrr.de # AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 27.01.2021 13:42 # CREATED: 27.01.2021 13:42
# #
#### $$VERSION$$ v1.35-dev-29-g0c0dc01 #### $$VERSION$$ v1.40-dev-32-gd876f75
#=============================================================================== #===============================================================================
# shellcheck disable=SC2059 # shellcheck disable=SC2059
@ -38,7 +38,10 @@ my_init() {
# #
# delete from here to disable extended initialisation # delete from here to disable extended initialisation
bot_init() { 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" local runuser chown touser botname DEBUG="$1"
# upgrade from old version # upgrade from old version
# currently no action # currently no action

View File

@ -15,7 +15,7 @@ USAGE='process_update.sh [-h|--help] [debug] [<file]'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de # AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 30.01.2021 19:14 # CREATED: 30.01.2021 19:14
# #
#### $$VERSION$$ v1.40-dev-13-g2a3663a #### $$VERSION$$ v1.40-dev-32-gd876f75
#=============================================================================== #===============================================================================
#### ####
@ -31,7 +31,7 @@ print_help "${1:-nix}"
# ready, do stuff here ----- # ready, do stuff here -----
# read json from stdin and convert update format # read json from stdin and convert update format
json='{"result": {"0":'"$(cat)"'}}' json='{"result": ['"$(cat)"']}'
UPDATE="$(${JSONSHFILE} -b -n <<<"${json}" 2>/dev/null)" UPDATE="$(${JSONSHFILE} -b -n <<<"${json}" 2>/dev/null)"
# assign to bashbot ARRAY # assign to bashbot ARRAY