dev/: fix missing ${xxx}

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-05 11:40:28 +01:00
parent 641727dc99
commit 9ef8778f85
9 changed files with 39 additions and 38 deletions

View File

@ -5,14 +5,14 @@
# #
# Description: run all tests, exit after failed test # Description: run all tests, exit after failed test
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-6-g641727d
############################################################# #############################################################
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script # no matter from which directory we'll run script
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ "$GIT_DIR" != "" ] ; then if [ "${GIT_DIR}" != "" ] ; then
cd "$GIT_DIR/.." || exit 1 cd "${GIT_DIR}/.." || exit 1
else else
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
fi fi
@ -52,7 +52,7 @@ do
"${test}" "${TESTENV}" "${test}" "${TESTENV}"
ret=$? ret=$?
set +e set +e
if [ "$ret" -eq 0 ] ; then if [ "${ret}" -eq 0 ] ; then
printf "OK: ---- %s\n" "${test}" printf "OK: ---- %s\n" "${test}"
passed=$((passed+1)) passed=$((passed+1))
else else
@ -64,7 +64,7 @@ done
########################### ###########################
# cleanup depending on test state # cleanup depending on test state
if [ "$fail" -eq 0 ]; then if [ "${fail}" -eq 0 ]; then
printf 'SUCCESS ' printf 'SUCCESS '
exitcode=0 exitcode=0
rm -rf "${TESTENV}" rm -rf "${TESTENV}"
@ -82,4 +82,4 @@ printf "%s\n\n" "${passed} / ${tests}"
ls -ld /tmp/bashbot.test* 2>/dev/null && printf "Do not forget to delete bashbot test files in /tmp!!\n" ls -ld /tmp/bashbot.test* 2>/dev/null && printf "Do not forget to delete bashbot test files in /tmp!!\n"
exit ${exitcode} exit "${exitcode}"

View File

@ -3,13 +3,13 @@
# #
# works together with git pre-push.sh and ADD all changed files since last push # works together with git pre-push.sh and ADD all changed files since last push
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-6-g641727d
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script # no matter from which directory we'll run script
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ "$GIT_DIR" != "" ] ; then if [ "${GIT_DIR}" != "" ] ; then
cd "$GIT_DIR/.." || exit 1 cd "${GIT_DIR}/.." || exit 1
else else
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
fi fi
@ -31,7 +31,7 @@ for file in ${FILES}
do do
[ -d "${file}" ] && continue [ -d "${file}" ] && continue
printf "%s" "${file} " printf "%s" "${file} "
git add "$file" git add "${file}"
done done
printf " - Done.\n" printf " - Done.\n"

View File

@ -7,7 +7,7 @@
# #
# Usage: source inject-json.sh # Usage: source inject-json.sh
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-6-g641727d
############################################################## ##############################################################
# download JSON.sh # download JSON.sh

View File

@ -1,13 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# this has to run once atfer git clone # this has to run once atfer git clone
# and every time we create new hooks # and every time we create new hooks
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-6-g641727d
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script # no matter from which directory we'll run script
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ "$GIT_DIR" != "" ] ; then if [ "${GIT_DIR}" != "" ] ; then
cd "$GIT_DIR/.." || exit 1 cd "${GIT_DIR}/.." || exit 1
else else
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
fi fi
@ -19,7 +19,7 @@ for hook in pre-commit post-commit pre-push
do do
rm -f "${GIT_DIR}/hooks/${hook}" rm -f "${GIT_DIR}/hooks/${hook}"
if [ -f "${HOOKDIR}/${hook}.sh" ]; then if [ -f "${HOOKDIR}/${hook}.sh" ]; then
printf "%s"" $hook" printf "%s"" ${hook}"
ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}" ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}"
fi fi
done done

View File

@ -7,15 +7,15 @@
# #
# Options: --notest - skip tests # Options: --notest - skip tests
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-6-g641727d
############################################################## ##############################################################
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script # no matter from which directory we'll run script
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ "$GIT_DIR" != "" ] ; then if [ "${GIT_DIR}" != "" ] ; then
[[ "$GIT_DIR" != "/"* ]] && GIT_DIR="${PWD}/${GIT_DIR}" [[ "${GIT_DIR}" != "/"* ]] && GIT_DIR="${PWD}/${GIT_DIR}"
cd "$GIT_DIR/.." || exit 1 cd "${GIT_DIR}/.." || exit 1
else else
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
fi fi
@ -47,6 +47,7 @@ cp -r ${DISTFILES} "${DISTDIR}"
cd "${DISTDIR}" || exit 1 cd "${DISTDIR}" || exit 1
printf "Create directories\n" printf "Create directories\n"
# shellcheck disable=SC2250
for dir in $DISTMKDIR for dir in $DISTMKDIR
do do
[ ! -d "${dir}" ] && mkdir "${dir}" [ ! -d "${dir}" ] && mkdir "${dir}"
@ -62,7 +63,7 @@ done
# inject JSON.sh into distribution # inject JSON.sh into distribution
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$GIT_DIR/../dev/inject-json.sh" source "${GIT_DIR}/../dev/inject-json.sh"
# make html doc # make html doc
printf "Create html doc\n" printf "Create html doc\n"
@ -73,13 +74,13 @@ source "../../dev/make-html.sh"
cd .. || exit 1 cd .. || exit 1
printf "Create dist archives\n" printf "Create dist archives\n"
# shellcheck disable=SC2046 # shellcheck disable=SC2046
zip -rq - "${DISTNAME}" --exclude $(cat "$GIT_DIR/../dev/${0##*/}.exclude") >"${DISTNAME}-${VERSION}.zip" zip -rq - "${DISTNAME}" --exclude $(cat "${GIT_DIR}/../dev/${0##*/}.exclude") >"${DISTNAME}-${VERSION}.zip"
tar --exclude-ignore="$GIT_DIR/../dev/${0##*/}.exclude" -czf "${DISTNAME}-${VERSION}.tar.gz" "${DISTNAME}" tar --exclude-ignore="${GIT_DIR}/../dev/${0##*/}.exclude" -czf "${DISTNAME}-${VERSION}.tar.gz" "${DISTNAME}"
printf "%s Done!\n" "$0" printf "%s Done!\n" "$0"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
ls -ld ${DISTNAME}-${VERSION}.* ls -ld "${DISTNAME}-${VERSION}".*
# an empty DEBUG.log is created ... :-( # an empty DEBUG.log is created ... :-(
rm -f "$GIT_DIR/../test/"*.log rm -f "${GIT_DIR}/../test/"*.log

View File

@ -7,7 +7,7 @@
# #
# Usage: source make-hmtl # Usage: source make-hmtl
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-6-g641727d
############################################################## ##############################################################
# check for correct dir # check for correct dir
@ -36,7 +36,7 @@ else
'printf "."; pandoc -s -f commonmark -M "title=Bashobot Documentation - ${0%.md}.html" "${0}" -o "${0%.md}.html"' {} \; 'printf "."; pandoc -s -f commonmark -M "title=Bashobot Documentation - ${0%.md}.html" "${0}" -o "${0%.md}.html"' {} \;
fi fi
# final: convert links from *.md to *.html # final: convert links from *.md to *.html
find README.html html ${EXAMPLES} -iname "*.html" -type f -exec sh -c\ find README.html html "${EXAMPLES}" -iname "*.html" -type f -exec sh -c\
'sed -i -E "s/href=\"(\.\.\/)*doc\//href=\"\1html\//g;s/href=\"(.*).md(#.*)*\"/href=\"\1.html\"/g" ${0}' {} \; 'sed -i -E "s/href=\"(\.\.\/)*doc\//href=\"\1html\//g;s/href=\"(.*).md(#.*)*\"/href=\"\1.html\"/g" ${0}' {} \;
printf " Done!\n" printf " Done!\n"
fi fi

View File

@ -9,21 +9,21 @@
# If you your bot is finished you can use make-standalone.sh to create the # 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! # the old all-in-one bashbot: bashbot.sh and commands.sh only!
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-6-g641727d
################################################################### ###################################################################
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script # no matter from which directory we'll run script
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ "$GIT_DIR" != "" ] ; then if [ "${GIT_DIR}" != "" ] ; then
[[ "$GIT_DIR" != "/"* ]] && GIT_DIR="${PWD}/${GIT_DIR}" [[ "${GIT_DIR}" != "/"* ]] && GIT_DIR="${PWD}/${GIT_DIR}"
cd "$GIT_DIR/.." || exit 1 cd "${GIT_DIR}/.." || exit 1
else else
[ ! -f "bashbot.sh" ] && printf "bashbot.sh not found in %s\n" " $(pwd)" && exit 1 [ ! -f "bashbot.sh" ] && printf "bashbot.sh not found in %s\n" " $(pwd)" && exit 1
fi fi
#DISTNAME="telegram-bot-bash" #DISTNAME="telegram-bot-bash"
DISTDIR="./STANDALONE/${DISTNAME}" DISTDIR="./STANDALONE"
DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh dev/obfuscate.sh modules scripts logs LICENSE README.* doc botacl botconfig.jssh" DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh dev/obfuscate.sh modules scripts logs LICENSE README.* doc botacl botconfig.jssh"
# run pre_commit on files # run pre_commit on files
@ -37,7 +37,7 @@ cd "${DISTDIR}" || exit 1
# inject JSON.sh into distribution # inject JSON.sh into distribution
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$GIT_DIR/../dev/inject-json.sh" source "${GIT_DIR}/../dev/inject-json.sh"
####################### #######################
# here the magic starts # here the magic starts
@ -95,7 +95,7 @@ chmod +x bashbot.sh.min
# make html doc # make html doc
printf "Create html doc\n" printf "Create html doc\n"
#shellcheck disable=SC1090 #shellcheck disable=SC1090
source "$GIT_DIR/../dev/make-html.sh" source "${GIT_DIR}/../dev/make-html.sh"
printf "%s Done!\n" "$0" printf "%s Done!\n" "$0"

View File

@ -2,7 +2,7 @@
# #
# joke hack to obfuscate bashbot.min.sh # joke hack to obfuscate bashbot.min.sh
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-6-g641727d
# shellcheck disable=SC2028,SC2016,SC1117 # shellcheck disable=SC2028,SC2016,SC1117
infile="bashbot.sh" infile="bashbot.sh"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
#### $$VERSION$$ v1.21-0-gc85af77 #### $$VERSION$$ v1.25-dev-6-g641727d
# shellcheck disable=SC2016 # shellcheck disable=SC2016
# #
# Easy Versioning in git: # Easy Versioning in git:
@ -37,8 +37,8 @@
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script # no matter from which directory we'll run script
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ "$GIT_DIR" != "" ] ; then if [ "${GIT_DIR}" != "" ] ; then
cd "$GIT_DIR/.." || exit 1 cd "${GIT_DIR}/.." || exit 1
else else
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
fi fi
@ -52,7 +52,7 @@ printf "Update to version %s ...\n" "${VERSION}"
FILES="$(find ./*)" FILES="$(find ./*)"
[ "$1" != "" ] && FILES="$*" [ "$1" != "" ] && FILES="$*"
for file in $FILES for file in ${FILES}
do do
[ ! -f "${file}" ] && continue [ ! -f "${file}" ] && continue
#[ "${file}" == "version" ] && continue #[ "${file}" == "version" ] && continue