factor out inject-json.sh

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-12-27 21:19:32 +01:00
parent 249dbb0471
commit b5e4f53357
4 changed files with 60 additions and 23 deletions

34
dev/inject-json.sh Normal file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
##############################################################
#
# File: inject-json.sh
#
# Description: download and prepare JSON.sh and JSON.awk
#
# Usage: source inject-json.sh
#
#### $$VERSION$$ v1.21-dev-17-g8c9298d
##############################################################
# download JSON.sh
JSONSHFILE="JSON.sh/JSON.sh"
if [ ! -r "${JSONSHFILE}" ]; then
printf "Inject JSON.sh ... "
mkdir "JSON.sh" 2>/dev/null
curl -sL -o "${JSONSHFILE}" "https://cdn.jsdelivr.net/gh/dominictarr/JSON.sh/JSON.sh"
chmod +x "${JSONSHFILE}"
printf "Done!\n"
fi
# download JSON.awk
JSONSHFILE="JSON.sh/JSON.awk"
if [ ! -r "${JSONSHFILE}" ]; then
printf "Inject JSON.awk ... "
curl -sL -o "${JSONSHFILE}" "https://cdn.jsdelivr.net/gh/step-/JSON.awk/JSON.awk"
curl -sL -o "${JSONSHFILE%/*}/awk-patch.sh" "https://cdn.jsdelivr.net/gh/step-/JSON.awk/tool/patch-for-busybox-awk.sh"
printf "Done!\n"
bash "${JSONSHFILE%/*}/awk-patch.sh" "${JSONSHFILE%/*}/JSON.awk"
fi
# delete backup files
rm -f "${JSONSHFILE%/*}"/*.bak

View File

@ -7,7 +7,7 @@
# #
# Options: --notest - skip tests # Options: --notest - skip tests
# #
#### $$VERSION$$ v1.21-dev-16-geedd0b3 #### $$VERSION$$ v1.21-dev-17-g8c9298d
############################################################## ##############################################################
# 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,
@ -53,22 +53,9 @@ do
mv "${file}" "${file}.dist" mv "${file}" "${file}.dist"
done done
# dwonload JSON.sh # inject JSON.sh into distribution
echo "Inject JSON.sh" # shellcheck disable=SC1090
JSONSHFILE="JSON.sh/JSON.sh" source "$GIT_DIR/../dev/inject-json.sh"
if [ ! -r "${JSONSHFILE}" ]; then
mkdir "JSON.sh" 2>/dev/null
curl -sL -o "${JSONSHFILE}" "https://cdn.jsdelivr.net/gh/dominictarr/JSON.sh/JSON.sh"
chmod +x "${JSONSHFILE}"
fi
echo "Inject JSON.awk"
JSONSHFILE="JSON.sh/JSON.awk"
if [ ! -r "${JSONSHFILE}" ]; then
curl -sL -o "${JSONSHFILE}" "https://cdn.jsdelivr.net/gh/step-/JSON.awk/JSON.awk"
curl -sL -o "${JSONSHFILE%/*}/awk-patch.sh" "https://cdn.jsdelivr.net/gh/step-/JSON.awk/tool/patch-for-busybox-awk.sh"
bash "${JSONSHFILE%/*}/awk-patch.sh" "${JSONSHFILE%/*}/JSON.awk"
fi
rm -f "${JSONSHFILE%/*}"/*.bak
# make html doc # make html doc
echo "Create html doc" echo "Create html doc"

View File

@ -1,7 +1,14 @@
data-bot-bash/* data-bot-bash/*
*.jssh *.jssh*
botacl botacl
*.flock *.flock
*.log *.log
*.last *.last
*.ok *.ok
*.bad
*.bak
*.jpg
*.jpeg
*.png
*.zip
*.gz

View File

@ -1,11 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# file: make-standalone.sh ###################################################################
#
# File: make-standalone.sh
#
# Description:
# even after make-distribution.sh bashbot is not self contained as it was in the past. # even after make-distribution.sh bashbot is not self contained as it was in the past.
# #
# 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.20-0-g2ab00a2 #### $$VERSION$$ v1.21-dev-17-g8c9298d
###################################################################
# 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
@ -30,6 +35,10 @@ mkdir -p "${DISTDIR}" 2>/dev/null
cp -r ${DISTFILES} "${DISTDIR}" 2>/dev/null cp -r ${DISTFILES} "${DISTDIR}" 2>/dev/null
cd "${DISTDIR}" || exit 1 cd "${DISTDIR}" || exit 1
# inject JSON.sh into distribution
# shellcheck disable=SC1090
source "$GIT_DIR/../dev/inject-json.sh"
####################### #######################
# here the magic starts # here the magic starts
# create all in one bashbot.sh file # create all in one bashbot.sh file