From 41e688381762e242852dbf6fac741f6150fce9cc Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Sun, 7 Mar 2021 09:09:48 +0100 Subject: [PATCH] dev: make-standalone: improvments, extra files, make-dist: exclude test --- bin/process_batch.sh | 6 +++--- dev/make-distribution.sh | 6 +++--- dev/make-distribution.sh.exclude | 4 +++- dev/make-standalone.sh | 7 +++++-- dev/make-standalone.sh.include | 1 + 5 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 dev/make-standalone.sh.include diff --git a/bin/process_batch.sh b/bin/process_batch.sh index 38f0bba..7e59c93 100755 --- a/bin/process_batch.sh +++ b/bin/process_batch.sh @@ -21,7 +21,7 @@ USAGE='process_update.sh [-h|--help] [-s|--startbot] [-w|--watch] [-n|--lines n] # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 27.02.2021 13:14 # -#### $$VERSION$$ v1.45-dev-80-g2463866 +#### $$VERSION$$ v1.45-dev-84-gae525c4 #=============================================================================== #### @@ -62,7 +62,7 @@ if [ -n "${startbot}" ]; then # warn when starting bot without pipe [ -p "${file}" ] || printf "%(%c)T: %b\n" -1 "${ORANGE}Warning${NC}: File is not a pipe:${GREY} ${file##*/}${NC}" start_bot "$2" "webhook" - printf "%(%c)T: %b\n" -1 "${GREEN}Bot start actions done, start reading updates ....${NN}" + printf "%(%c)T: %b\n" -1 "${GREEN}Bot start actions done, start reading updates ....${NC}" fi # check file exist if [[ ! -r "${file}" || -d "${file}" ]]; then @@ -74,7 +74,7 @@ fi # ready, do stuff here ----- # kill all sub processes on exit -trap 'kill $(jobs -p) 2>/dev/null; send_normal_message "'"${BOTADMIN}"'" "Bot '"${BOTNAME}"' webhook stopped ..."; printf "%(%c)T: %s\n" -1 "Bot in batch mode killed!\n"' EXIT HUP QUIT +trap 'kill $(jobs -p) 2>/dev/null; send_normal_message "'"${BOTADMIN}"'" "Bot '"${BOTNAME}"' webhook stopped ..."; printf "%(%c)T: %s\n" -1 "Bot in batch mode killed!"' EXIT HUP QUIT # wait after (first) update to avoid processing to many in parallel UPDWAIT="0.5" diff --git a/dev/make-distribution.sh b/dev/make-distribution.sh index 962944b..e5a7c15 100755 --- a/dev/make-distribution.sh +++ b/dev/make-distribution.sh @@ -7,7 +7,7 @@ # # Options: --notest - skip tests # -#### $$VERSION$$ v1.45-dev-83-g47a032d +#### $$VERSION$$ v1.45-dev-84-gae525c4 ############################################################## #shellcheck disable=SC1090 @@ -20,7 +20,7 @@ DISTDIR="./DIST/${DISTNAME}" DISTMKDIR="data-bot-bash logs bin bin/logs addons" DISTFILES="bashbot.sh commands.sh mycommands.sh.clean bin doc examples scripts modules LICENSE README.md README.txt README.html" -DISTFILESDEV="dev/make-standalone.sh dev/inject-json.sh dev/make-html.sh dev/obfuscate.sh" +DISTFILESDEV="dev/make-standalone.sh dev/make-standalone.sh.include dev/inject-json.sh dev/make-html.sh dev/obfuscate.sh" DISTFILESDIST="mycommands.sh mycommands.conf bashbot.rc $(echo "addons/"*.sh)" # run tests first! @@ -40,7 +40,7 @@ mkdir -p "${DISTDIR}" 2>/dev/null printf "Copy files\n" # shellcheck disable=SC2086 cp -r ${DISTFILES} "${DISTDIR}" -mkdir "${DISTDIR}/dev" +mkdir -p "${DISTDIR}/dev" # shellcheck disable=SC2086 cp ${DISTFILESDEV} "${DISTDIR}/dev" cd "${DISTDIR}" || exit 1 diff --git a/dev/make-distribution.sh.exclude b/dev/make-distribution.sh.exclude index c03a2d7..5098716 100644 --- a/dev/make-distribution.sh.exclude +++ b/dev/make-distribution.sh.exclude @@ -1,5 +1,7 @@ +STANDALONE data-bot-bash/* -webhook-fifo +test +webhook-fifo* JSON.awk bashbot.rc mycommands.sh diff --git a/dev/make-standalone.sh b/dev/make-standalone.sh index 27dc15f..bef39a1 100755 --- a/dev/make-standalone.sh +++ b/dev/make-standalone.sh @@ -11,7 +11,7 @@ # If you your bot is finished you can use make-standalone.sh to create the # the old all-in-one bashbot: bashbot.sh and commands.sh only! # -#### $$VERSION$$ v1.45-dev-83-g47a032d +#### $$VERSION$$ v1.45-dev-84-gae525c4 ################################################################### # include git config and change to base dir @@ -37,9 +37,12 @@ fi #DISTNAME="telegram-bot-bash" DISTDIR="./STANDALONE" DISTMKDIR="data-bot-bash logs bin/logs addons" -DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh dev/obfuscate.sh modules scripts LICENSE README.* doc botacl botconfig.jssh addons" +DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh modules scripts LICENSE README.* doc botacl botconfig.jssh addons" DISTBINFILES="bin/bashbot_env.inc.sh bin/bashbot_stats.sh bin/process_batch.sh bin/process_update.sh bin/send_broadcast.sh bin/send_message.sh" +# add extra files +DISTFILES+=" $(cat "${BASE_DIR}/dev/${0##*/}.include")" + # create dir for distribution and copy files printf "Create directories and copy files\n" mkdir -p "${DISTDIR}/bin" 2>/dev/null diff --git a/dev/make-standalone.sh.include b/dev/make-standalone.sh.include new file mode 100644 index 0000000..f92d11b --- /dev/null +++ b/dev/make-standalone.sh.include @@ -0,0 +1 @@ +dev/obfuscate.sh