fix wrong json.sh location if included from other location

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-06-04 16:10:58 +02:00
parent 8e7583d3b7
commit c729cf428b

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# #
#### $$VERSION$$ 0.96-dev2-11-ge366633 #### $$VERSION$$ V0.94-6-gdcf6534
# #
# Exit Codes: # Exit Codes:
# - 0 sucess (hopefully) # - 0 sucess (hopefully)
@ -84,14 +84,16 @@ fi
if [ -n "$BASHBOT_HOME" ]; then if [ -n "$BASHBOT_HOME" ]; then
SCRIPTDIR="$BASHBOT_HOME" SCRIPTDIR="$BASHBOT_HOME"
else
BASHBOT_HOME="${SCRIPTDIR}"
fi
[ -z "${BASHBOT_ETC}" ] && BASHBOT_ETC="$BASHBOT_HOME" [ -z "${BASHBOT_ETC}" ] && BASHBOT_ETC="$BASHBOT_HOME"
[ -z "${BASHBOT_VAR}" ] && BASHBOT_VAR="$BASHBOT_HOME" [ -z "${BASHBOT_VAR}" ] && BASHBOT_VAR="$BASHBOT_HOME"
fi
ADDONDIR="${BASHBOT_ETC:-./addons}" ADDONDIR="${BASHBOT_ETC:-./addons}"
RUNUSER="${USER}" # USER is overwritten by bashbot array RUNUSER="${USER}" # USER is overwritten by bashbot array
# OK everthing setup, lest start
if [ "${SOURCE}" != "yes" ] && [ -z "$BASHBOT_HOME" ] && ! cd "${RUNDIR}" ; then if [ "${SOURCE}" != "yes" ] && [ -z "$BASHBOT_HOME" ] && ! cd "${RUNDIR}" ; then
echo -e "${RED}ERROR: Can't change to ${RUNDIR} ...${NC}" echo -e "${RED}ERROR: Can't change to ${RUNDIR} ...${NC}"
exit 1 exit 1
@ -777,7 +779,7 @@ if ! _is_function send_message ; then
exit 1 exit 1
fi fi
JSONSHFILE="${BASHBOT_JSONSH:-${RUNDIR}/JSON.sh/JSON.sh}" JSONSHFILE="${BASHBOT_JSONSH:-${SCRIPTDIR}/JSON.sh/JSON.sh}"
[[ "${JSONSHFILE}" != *"/JSON.sh" ]] && echo -e "${RED}ERROR: \"${JSONSHFILE}\" ends not with \"JSONS.sh\".${NC}" && exit 3 [[ "${JSONSHFILE}" != *"/JSON.sh" ]] && echo -e "${RED}ERROR: \"${JSONSHFILE}\" ends not with \"JSONS.sh\".${NC}" && exit 3
if [ ! -f "${JSONSHFILE}" ]; then if [ ! -f "${JSONSHFILE}" ]; then