diff --git a/bashbot.sh b/bashbot.sh index 173bc77..dfb85c1 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -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-20-gbd22e2a +#### $$VERSION$$ v0.96-dev3-21-g6f86036 # # Exit Codes: # - 0 sucess (hopefully) @@ -820,7 +820,7 @@ JSONSHFILE="${BASHBOT_JSONSH:-${SCRIPTDIR}/JSON.sh/JSON.sh}" if [ ! -f "${JSONSHFILE}" ]; then echo "Seems to be first run, Downloading ${JSONSHFILE}..." - [[ "${JSONSHFILE}" = "${RUNDIR}/JSON.sh/JSON.sh" ]] && mkdir "JSON.sh" 2>/dev/null && chmod +w "JSON.sh" + mkdir "${SCRIPTDIR}/JSON.sh" 2>/dev/null && chmod +w "${SCRIPTDIR}/JSON.sh" getJson "https://cdn.jsdelivr.net/gh/dominictarr/JSON.sh/JSON.sh" >"${JSONSHFILE}" chmod +x "${JSONSHFILE}" fi diff --git a/dev/make-standalone.sh b/dev/make-standalone.sh index ef25f60..4080d15 100755 --- a/dev/make-standalone.sh +++ b/dev/make-standalone.sh @@ -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$$ v0.96-dev3-20-gbd22e2a +#### $$VERSION$$ v0.96-dev3-21-g6f86036 # magic to ensure that we're always inside the root of our application, # no matter from which directory we'll run script @@ -18,7 +18,7 @@ fi #DISTNAME="telegram-bot-bash" DISTDIR="./STANDALONE/${DISTNAME}" -DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh modules LICENSE README.txt token count botacl botadmin" +DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh dev/obfuscate.sh modules LICENSE README.txt token count botacl botadmin" # run pre_commit on files dev/hooks/pre-commit.sh diff --git a/dev/obfuscate.sh b/dev/obfuscate.sh new file mode 100755 index 0000000..9f2da99 --- /dev/null +++ b/dev/obfuscate.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# shellcheck disable=SC2028,2016 +# joke hack to obfuscate bashbot.min.sh + +infile="bashbot.sh" +outfile="./bashbot.obf.sh" + +[ ! -f "${infile}" ] && echo "Hey, this is a joke hack to obfuscate ${infile}, copy me to STANDANLONE first" && exit + +{ +echo '#!/bin/bash' +echo 'b="./bashbot";h="$PWD";cd "$(mktemp -d)"||exit' +echo 'printf '"'%s\n'"' '"'$(gzip -9 "$b";export BASHBOT_HOME="$h";chmod +x "$b";"$b" "$@";b="$(pwd)";cd ..;#rm -rf "$b"' +} >"${outfile}" + +chmod +x "${outfile}" +ls -l "${outfile}" +echo "Try to run ${outfile} init ;-)"