fix make-standalone, add minimized standalone version

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-06-08 12:04:48 +02:00
parent 8792e8353c
commit bd22e2aa17
3 changed files with 11 additions and 14 deletions

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v0.96-dev3-15-g3fcb854
#### $$VERSION$$ v0.96-dev3-19-g8792e83
#
# Exit Codes:
# - 0 sucess (hopefully)

View File

@ -5,7 +5,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$$ 0.96-dev2-6-gda98b09
#### $$VERSION$$ v0.96-dev3-19-g8792e83
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
@ -20,16 +20,8 @@ fi
DISTDIR="./STANDALONE/${DISTNAME}"
DISTFILES="bashbot.sh commands.sh mycommands.sh modules LICENSE README.txt token count botacl botadmin"
# run tests first!
for test in dev/all-test*.sh
do
[ ! -x "${test}" ] && continue
if ! "${test}" ; then
echo "Test ${test} failed, can't create standalone!"
exit 1
fi
done
# run pre_commit on files
dev/hooks/pre-commit.sh
# create dir for distribution and copy files
mkdir -p "${DISTDIR}" 2>/dev/null
@ -41,7 +33,7 @@ cd "${DISTDIR}" || exit 1
# here the magic starts
# create all in one bashbot.sh file
echo "OK, noe lets do the magic ..."
echo "OK, now lets do the magic ..."
echo " ... create unified commands.sh"
{
@ -82,6 +74,11 @@ chmod +x bashbot.sh
rm -rf modules
echo "Create minimized Version of bashbot.sh and commands.sh"
sed -E -e '/(shellcheck)|(#!\/bin\/bash)/! s/^[[:space:]]*#.*//' -e 's/^[[:space:]]*//' -e '/^$/d' bashbot.sh > bashbot.sh.min
sed -E -e '/(shellcheck)|(#!\/bin\/bash)/! s/^[[:space:]]*#.*//' -e 's/^[[:space:]]*//' -e '/^$/d' commands.sh > commands.sh.min
chmod +x bashbot.sh.min
echo "Done!"
cd .. || exit 1

View File

@ -382,5 +382,5 @@ for every poll until the maximum of BASHBOT_SLEEP ms.
#### [Prev Advanced Use](3_advanced.md)
#### [Next Best Practice](5_practice.md)
#### $$VERSION$$ v0.96-dev3-16-gd11598e
#### $$VERSION$$ v0.96-dev3-17-g720dc59