From f0758b79f85ebe37d3fd99aafe7c8fc0be297654 Mon Sep 17 00:00:00 2001 From: Martin Bless Date: Sat, 28 Nov 2020 23:54:08 +0100 Subject: [PATCH] [FEATURE] Add dockrun_t3rd.bat for Windows users --- ALL-for-build/Downloads/dockrun_t3rd.bat | 258 ++++++++++++++++++++++ ALL-for-build/Menu/mainmenu.sh | 7 + ALL-for-build/Menu/show-shell-commands.sh | 207 +---------------- ALL-for-build/Menu/show-windows-bat.sh | 210 ++++++++++++++++++ 4 files changed, 477 insertions(+), 205 deletions(-) create mode 100755 ALL-for-build/Downloads/dockrun_t3rd.bat create mode 100755 ALL-for-build/Menu/show-windows-bat.sh diff --git a/ALL-for-build/Downloads/dockrun_t3rd.bat b/ALL-for-build/Downloads/dockrun_t3rd.bat new file mode 100755 index 0000000..8a29943 --- /dev/null +++ b/ALL-for-build/Downloads/dockrun_t3rd.bat @@ -0,0 +1,258 @@ +@echo OFF + +rem dockrun_t3rd.bat, mb, 2019-09-27, 2020-04-03, 2020-11-28 +rem Author: Martin.Bless@mbless.de +rem License: MIT (feel free, use on your own risk, cite me) +rem +rem Save this script as: %home%\dockrun_t3rd.bat +rem Run it like: %home%\dockrun_t3rd.bat [ARGS] ' +rem +rem Learn from https://en.wikibooks.org/wiki/Windows_Batch_Scripting +rem +rem Welcome to the power of Spaghetti code :-) +rem +rem Created and tested on Windows 10. +rem + +set PROJECT=%cd% +if not x%PROJECT:~-1%x == x\x ( + set PROJECT=%PROJECT%\ +) +set RESULT=%PROJECT%Documentation-GENERATED-temp +set TMP=%PROJECT%tmp-GENERATED-temp +if not exist %TMP% ( + set TMP= +) + +if x%T3DOCS_OURIMAGE%x == xx ( + set T3DOCS_OURIMAGE=t3docs/render-documentation:latest +) + +if not exist %RESULT% ( + mkdir %RESULT% +) + +set argcount=0 +set arg1=%1 +set arg2ff= +set allargs=%1 +shift +if not x%arg1%x == xx set /a argcount+=1 + +:collectargsstart +if x%1x==xx goto collectargsend +set allargs=%allargs% %1 +set arg2ff=%arg2ff% %1 +set /a argcount+=1 +shift +goto collectargsstart +:collectargsend + +if x%argcount%x==x0x ( + set interactive=1 +) else ( + set interactive=0 +) + +if x%interactive%x == x1x ( +echo. +echo. +echo. +echo. +) + + +if x%interactive%x == x0x goto oneshot + +:menu +echo. +echo ========================================== +echo Render TYPO3 documentation +echo ------------------------------------------ +echo Using : %T3DOCS_OURIMAGE% +echo PROJECT: %PROJECT% +echo RESULT : %RESULT% +echo TMP : %TMP% +echo. +echo CHOICE ACTION +echo ------ ----------------------------------- +echo 1 dockrun_t3rd.bat makehtml +echo 1nc dockrun_t3rd.bat makehtml-no-cache +echo 2 dockrun_t3rd.bat makeall +echo 2nc dockrun_t3rd.bat makeall-no-cache +echo bb dockrun_t3rd.bat /bin/bash +echo ea dockrun_t3rd.bat export-ALL +echo v dockrun_t3rd.bat --version +echo pull docker pull %T3DOCS_OURIMAGE% (fetch and update) +echo ? show usage +echo q quit - leave and do nothing +echo ------ ----------------------------------- +echo. +set INP= +set /P INP="Please enter your choice and press ENTER: " + +if "%INP%"=="1" goto makehtml +if "%INP%"=="1nc" goto makehtml-no-cache +if "%INP%"=="2" goto makeall +if "%INP%"=="2nc" goto makeall-no-cache +if "%INP%"=="bb" goto binbash +if "%INP%"=="h" goto containerhelp +if "%INP%"=="ea" goto exportall +if "%INP%"=="v" goto containerversion +if "%INP%"=="?" goto usage +if "%INP%"=="q" goto quit +if "%INP%"=="pull" goto pull +echo -------------------------- +echo unknown choice '%INP%' +pause +goto menu + + +:usage +echo. +echo ========================================== +echo Render TYPO3 documentation +echo ------------------------------------------ +echo. +echo Usage: +echo dockrun_t3rd.bat [ARGS] +echo. +echo Advice: +echo 1. Save the script to %%HOME%%\dockrun_t3rd.bat +echo 2. Start the script from everywhere with: +echo %%HOME%%\dockrun_t3rd.bat +echo. +echo Example: +echo %%HOME%%\dockrun_t3rd.bat makehtml -c make_singlehtml 1 +echo. +echo Usage: +echo dockrun_t3rd.bat [ARGS] +echo. +echo ARGUMENT DESCRIPTION +echo ? Show this menu +echo --version Show buildinfo.txt of this container +echo makeall Create all output formats +echo makeall-no-cache Remove cache first, then create all +echo makehtml Create HTML output +echo makehtml-no-cache Remove cache first, then build HTML +echo show-shell-commands Show useful linux shell commands and functions +echo show-bat-file Show source of dockrun_t3rd.bat +echo show-howto Show howto (not totally up to date) +echo show-faq Show questions and answers (not totally up to date) +echo bashcmd Run a bash command in the container +echo /bin/bash Enter the container's Bash shell as superuser +echo /usr/bin/bash Enter the container's Bash shell as normal user +echo export-ALL Copy /ALL to /RESULT/ALL-exported +echo tct Run TCT, the toolchain runner +echo. +echo Examples: +echo dockrun_t3rd.bat (enter interactive mode) +echo dockrun_t3rd.bat --help +echo dockrun_t3rd.bat export-ALL +echo dockrun_t3rd.bat makeall-no-cache +echo dockrun_t3rd.bat makehtml +echo dockrun_t3rd.bat bashcmd ls -la /ALL +echo dockrun_t3rd.bat /bin/bash +echo dockrun_t3rd.bat /usr/bin/bash +echo. +echo Container selection: +echo Set the environment variable T3DOCS_OURIMAGE to the container you want +echo to use. Afterwards run 'dockrun_t3rd.bat'. +echo. +echo Example: +echo set T3DOCS_OURIMAGE=t3docs/render-documentation:develop +echo cm %%HOME%%\dockrun_t3rd.bat +echo. +if x%interactive%x == x1x pause & goto menu +goto alldone + + +:binbash +set arg1=/bin/bash +goto menuaction + +:containerversion +set arg1=--version +goto menuaction + +:exportall +set arg1=export-ALL +goto menuaction + +:makeall +set arg1=makeall +goto menuaction + +:makeall-no-cache +set arg1=makeall-no-cache +goto menuaction + +:makehtml +set arg1=makehtml +goto menuaction + +:makehtml-no-cache +set arg1=makehtml-no-cache +goto menuaction + +:pull +docker pull %T3DOCS_OURIMAGE% +pause +goto menu + +:menuaction +set allargs=%arg1% +echo %arg1% +goto oneshot + +:oneshot +if x%arg1%x == x?x goto usage +if xx == xx ( + set cmd=docker run --rm + set trailingargs=%allargs% +) +if x%arg1%x == x/bin/bashx ( + set cmd=docker run --rm --entrypoint=/bin/bash -it + set trailingargs= +) +if x%arg1%x == x/usr/bin/bashx ( + set cmd=docker run --rm --entrypoint=/bin/bash -it + set trailingargs= +) +if x%arg1%x == xexport-ALLx ( + set cmd=docker run --rm --entrypoint=/bin/bash + set trailingargs=-c "rsync -a --delete /ALL/ /RESULT/ALL-exported" + echo The export will go to: + echo %RESULT%/ALL-exported +) +if x%arg1%x == xbashcmdx ( + set cmd=docker run --rm --entrypoint=/bin/bash + set trailingargs=-c %arg2ff% +) +set cmd=%cmd% -v %PROJECT%:/PROJECT:ro +set cmd=%cmd% -v %RESULT%:/RESULT +if not x%TMP%x == xx ( + set cmd=%cmd% -v %TMP%:/tmpq + +) +set cmd=%cmd% %T3DOCS_OURIMAGE% %trailingargs% +%cmd% + +if x%interactive%x == x1x pause +echo ------------------------------------------ +echo last call was: +echo dockrun_t3rd.bat %allargs% +echo. +echo last command was: +echo %cmd% +echo. +if x%interactive%x == x1x pause & goto menu +goto alldone + + +:quit +echo quit +goto alldone + + +:alldone diff --git a/ALL-for-build/Menu/mainmenu.sh b/ALL-for-build/Menu/mainmenu.sh index e147640..ffdac5c 100755 --- a/ALL-for-build/Menu/mainmenu.sh +++ b/ALL-for-build/Menu/mainmenu.sh @@ -64,6 +64,7 @@ Usage: makehtml Create HTML output makehtml-no-cache Remove cache first, then build HTML show-shell-commands Show useful shell commands and functions + show-windows-bat Show file 'dockrun_t3rd.bat' for Windows show-howto Show howto (not totally up to date) show-faq Show questions and answers (not totally up to date) bashcmd Run a bash command in the container @@ -82,6 +83,7 @@ Usage: ${DOCKRUN_PREFIX}$OUR_IMAGE_SHORT /bin/bash ${DOCKRUN_PREFIX}$OUR_IMAGE_SHORT /usr/bin/bash + End of usage. EOT } @@ -107,6 +109,11 @@ function mm-show-shell-commands() { } +function mm-show-windows-bat() { + $(dirname $0)/show-windows-bat.sh +} + + function mm-tct() { shift install-wheels diff --git a/ALL-for-build/Menu/show-shell-commands.sh b/ALL-for-build/Menu/show-shell-commands.sh index 3fac5ce..15494bf 100755 --- a/ALL-for-build/Menu/show-shell-commands.sh +++ b/ALL-for-build/Menu/show-shell-commands.sh @@ -3,208 +3,5 @@ source "$HOME/.bashrc" source /ALL/Downloads/envvars.sh -# provide defaults -#1 -VERSION=${VERSION:-"v0.0.0"} -DOCKRUN_PREFIX=${DOCKRUN_PREFIX:-"dockrun_"} -OUR_IMAGE_SHORT=${OUR_IMAGE_SHORT:-t3rd} -OUR_IMAGE_SLOGAN=${OUR_IMAGE_SLOGAN:-"t3rd - TYPO3 render documentation"} -#2 -OUR_IMAGE_TAG=${OUR_IMAGE_TAG:-"$VERSION"} -#3 -OUR_IMAGE=${OUR_IMAGE:-"t3docs/render-documentation:$OUR_IMAGE_TAG"} - -cat <shell-commands.sh -# source shell-commands.sh - -# the usual worker command like 'dockrun_t3rd' -function ${DOCKRUN_PREFIX}${OUR_IMAGE_SHORT} () { - -# Environment variables the USER may find important (on the host!), -# no slash ('/') at the end, -# default is the current directory \$(pwd): -# -# T3DOCS_PROJECT=/abspathto/MyProjectStartFolder (readonly) -# T3DOCS_RESULT=/abspathto/ResultFolder (readwrite) -# T3DOCS_TMP=/abspathto/TemporaryFolder (readwrite) -# T3DOCS_THEMES=/abspathto/MySphinxThemes (readonly) -# -# Environment variables only some DEVELOPERS may find important, -# no slash ('/') at the end, -# -# T3DOCS_MAKEDIR=/abspathto/MYALL/Makedir -# T3DOCS_MENU=/abspathto/MYALL/Menu -# T3DOCS_TOOLCHAINS=/abspathto/MYALL/Toolchains -# T3DOCS_USERHOME=/abspathto/MYALL/userhome -# T3DOCS_VENV=/abspathto/MYALL/venv -# T3DOCS_WHEELS=/abspathto/WheelsFolder -# T3DOCS_DEBUG=0 (0 or 1, talk to stdout) -# T3DOCS_DRY_RUN=0 (0 or 1, don't really execute) - -local DEBUG=\${T3DOCS_DEBUG:-0} -local DRY_RUN=\${T3DOCS_DRY_RUN:-0} -local git_restore_mtime=\$(which git-restore-mtime) -local exitcode=\$? -if [[ \$exitcode -ne 0 ]]; then git_restore_mtime=; fi - -# start command building -local cmd="docker run --rm" -if [[ \$# -eq 0 ]]; then - # create folders on host? (e.g. Documentation-GENERATED-temp) - local CREATING=1 - cmd="\$cmd --user=\$(id -u):\$(id -g)" -elif [[ "\$@" = "/bin/bash" ]]; then - local CREATING=1 - cmd="\$cmd --entrypoint /bin/bash -it" -elif [[ "\$@" = "/usr/bin/bash" ]]; then - local CREATING=1 - cmd="\$cmd --user=\$(id -u):\$(id -g)" - cmd="\$cmd --entrypoint /bin/bash -it" -elif [[ "\$@" = "export-ALL" ]]; then - local CREATING=1 - cmd="\$cmd --entrypoint /bin/bash" -else - local CREATING=1 - cmd="\$cmd --user=\$(id -u):\$(id -g)" -fi - -# PROJECT - read only! -# assume existing folder PROJECT/Documentation -# absolute path to existing folder PROJECT or current dir -local PROJECT=\${T3DOCS_PROJECT:-\$(pwd)} -cmd="\$cmd -v \$PROJECT:/PROJECT:ro" -if ((\$DEBUG)); then echo "PROJECT......: \$PROJECT"; fi - -# RESULT -# absolute path to existing folder RESULT of (RESULT/Documentation-GENERATED-temp) -local RESULT=\${T3DOCS_RESULT:-\$(pwd)} -# force special name to prevent create/delete disasters -RESULT=\${RESULT}/Documentation-GENERATED-temp -cmd="\$cmd -v \$RESULT:/RESULT" -if ((\$CREATING)); then - if ((\$DEBUG)); then echo creating: mkdir -p "\$RESULT" ; fi - mkdir -p "\$RESULT" 2>/dev/null -fi -if ((\$DEBUG)); then echo "RESULT.......: \$RESULT"; fi - -# TMP -# absolute path to existing folder TMP of (TMP/tmp-GENERATED-temp) -local TMP=\${T3DOCS_TMP:-\$(pwd)} -# force special name to prevent create/delete disasters -TMP=\${TMP}/tmp-GENERATED-temp -if ((\$CREATING)) && [[ -n "\${T3DOCS_TMP}" ]]; then - mkdir -p "\$TMP" 2>/dev/null -fi -if [[ -d "\${TMP}" ]]; then - cmd="\$cmd -v \$TMP:/tmp" - if ((\$CREATING)); then - /bin/bash -c "rm -rf \$TMP/*" - fi - if ((\$DEBUG)); then echo "TMP..........: \$TMP"; fi -fi - -# USERHOME -# absolute path to existing folder 'userhome' -local USERHOME=\${T3DOCS_USERHOME:-\$(pwd)/tmp-GENERATED-userhome} -if [ -d "\$USERHOME" ]; then - cmd="\$cmd -v \$USERHOME:/ALL/userhome" - if ((\$DEBUG)); then echo "USERHOME......: \$USERHOME"; fi -fi - -# MAKEDIR -# absolute path to existing folder MAKEDIR -local MAKEDIR=\${T3DOCS_MAKEDIR:-\$(pwd)/tmp-GENERATED-Makedir} -if [ -d "\$MAKEDIR" ]; then - cmd="\$cmd -v \$MAKEDIR:/ALL/Makedir" - if ((\$DEBUG)); then echo "MAKEDIR......: \$MAKEDIR"; fi -fi - -# MENU -# absolute path to existing folder MENU -local MENU=\${T3DOCS_MENU:-\$(pwd)/tmp-GENERATED-Menu} -if [ -d "\$MENU" ]; then - cmd="\$cmd -v \$MENU:/ALL/Menu" - if ((\$DEBUG)); then echo "MENU.........: \$MENU"; fi -fi - -# VENV (used to be 'Rundir') -# absolute path to existing folder VENV -local VENV=\${T3DOCS_VENV:-\$(pwd)/tmp-GENERATED-venv} -if [ -d "\$VENV" ]; then - cmd="\$cmd -v \$VENV:/ALL/venv" - if ((\$DEBUG)); then echo "VENV.........: \$VENV"; fi -fi - -# THEMES -# absolute path to a folder containing Sphinx themes -local THEMES=\${T3DOCS_THEMES:-\$(pwd)/tmp-GENERATED-Themes} -if [ -d "\$THEMES" ]; then - cmd="\$cmd -v \$THEMES:/THEMES" - if ((\$DEBUG)); then echo "THEMES.......: \$THEMES"; fi -fi - -# TOOLCHAINS -# absolute path to existing folder TOOLCHAINS -local TOOLCHAINS=\${T3DOCS_TOOLCHAINS:-\$(pwd)/tmp-GENERATED-Toolchains} -if [ -d "\$TOOLCHAINS" ]; then - cmd="\$cmd -v \$TOOLCHAINS:/ALL/Toolchains" - if ((\$DEBUG)); then echo "TOOLCHAINS...: \$TOOLCHAINS"; fi -fi - -# WHEELS -# absolute path to a folder containing Python wheel packages -local WHEELS=\${T3DOCS_WHEELS:-\$(pwd)/tmp-GENERATED-Wheels} -if [ -d "\$WHEELS" ]; then - cmd="\$cmd -v \$WHEELS:/WHEELS" - if ((\$DEBUG)); then echo "WHEELS.......: \$WHEELS"; fi -fi - -cmd="\$cmd $OUR_IMAGE" -if ((\$DEBUG)); then echo "OUR_IMAGE....: $OUR_IMAGE"; fi - -# add remaining arguments -if [[ "\$@" = "/bin/bash" ]]; then - true "do nothing here" -elif [[ "\$@" = "/usr/bin/bash" ]]; then - true "do nothing here" -elif [[ "\$@" = "export-ALL" ]]; then - cmd="\$cmd -c \"rsync -a --delete --chown=\$(id -u):\$(id -g) /ALL/ /RESULT/ALL-exported\"" - echo The export will go to: - echo " \$RESULT/ALL-exported" - -else - cmd="\$cmd \$@" - # if script git-restore-mtime exists and '*make*' in args try the command - # See README: get 'git-restore-mtime' from https://github.com/MestreLion/git-tools - if [[ "\$git_restore_mtime" != "" ]] && [[ \$@ =~ .*make.* ]]; then - if ((\$DEBUG)); then - echo \$git_restore_mtime - \$git_restore_mtime - else - \$git_restore_mtime 2>/dev/null - fi - fi -fi -if [[ -w "\$RESULT" ]]; then true - echo "\$cmd" | sed "s/-v /\\\\\\\\\\\\n -v /g" >"\$RESULT/last-docker-run-command-GENERATED.sh.txt" -fi -if ((\$DEBUG || \$DRY_RUN)); then - echo \$cmd | sed "s/-v /\\\\\\\\\\\\n -v /g" -fi -if [[ "\$DRY_RUN" = "0" ]]; then - eval "\$cmd" -fi -} - -echo "This function is now defined FOR THIS terminal window to run ${OUR_IMAGE_TAG}:" -echo " ${DOCKRUN_PREFIX}${OUR_IMAGE_SHORT}" - -EOT \ No newline at end of file +# show line endings as CRLF +cat /ALL/Downloads/dockrun_t3rd.bat | sed -e 's/$/\r/' diff --git a/ALL-for-build/Menu/show-windows-bat.sh b/ALL-for-build/Menu/show-windows-bat.sh new file mode 100755 index 0000000..3fac5ce --- /dev/null +++ b/ALL-for-build/Menu/show-windows-bat.sh @@ -0,0 +1,210 @@ +#!/bin/bash + +source "$HOME/.bashrc" +source /ALL/Downloads/envvars.sh + +# provide defaults +#1 +VERSION=${VERSION:-"v0.0.0"} +DOCKRUN_PREFIX=${DOCKRUN_PREFIX:-"dockrun_"} +OUR_IMAGE_SHORT=${OUR_IMAGE_SHORT:-t3rd} +OUR_IMAGE_SLOGAN=${OUR_IMAGE_SLOGAN:-"t3rd - TYPO3 render documentation"} +#2 +OUR_IMAGE_TAG=${OUR_IMAGE_TAG:-"$VERSION"} +#3 +OUR_IMAGE=${OUR_IMAGE:-"t3docs/render-documentation:$OUR_IMAGE_TAG"} + +cat <shell-commands.sh +# source shell-commands.sh + +# the usual worker command like 'dockrun_t3rd' +function ${DOCKRUN_PREFIX}${OUR_IMAGE_SHORT} () { + +# Environment variables the USER may find important (on the host!), +# no slash ('/') at the end, +# default is the current directory \$(pwd): +# +# T3DOCS_PROJECT=/abspathto/MyProjectStartFolder (readonly) +# T3DOCS_RESULT=/abspathto/ResultFolder (readwrite) +# T3DOCS_TMP=/abspathto/TemporaryFolder (readwrite) +# T3DOCS_THEMES=/abspathto/MySphinxThemes (readonly) +# +# Environment variables only some DEVELOPERS may find important, +# no slash ('/') at the end, +# +# T3DOCS_MAKEDIR=/abspathto/MYALL/Makedir +# T3DOCS_MENU=/abspathto/MYALL/Menu +# T3DOCS_TOOLCHAINS=/abspathto/MYALL/Toolchains +# T3DOCS_USERHOME=/abspathto/MYALL/userhome +# T3DOCS_VENV=/abspathto/MYALL/venv +# T3DOCS_WHEELS=/abspathto/WheelsFolder +# T3DOCS_DEBUG=0 (0 or 1, talk to stdout) +# T3DOCS_DRY_RUN=0 (0 or 1, don't really execute) + +local DEBUG=\${T3DOCS_DEBUG:-0} +local DRY_RUN=\${T3DOCS_DRY_RUN:-0} +local git_restore_mtime=\$(which git-restore-mtime) +local exitcode=\$? +if [[ \$exitcode -ne 0 ]]; then git_restore_mtime=; fi + +# start command building +local cmd="docker run --rm" +if [[ \$# -eq 0 ]]; then + # create folders on host? (e.g. Documentation-GENERATED-temp) + local CREATING=1 + cmd="\$cmd --user=\$(id -u):\$(id -g)" +elif [[ "\$@" = "/bin/bash" ]]; then + local CREATING=1 + cmd="\$cmd --entrypoint /bin/bash -it" +elif [[ "\$@" = "/usr/bin/bash" ]]; then + local CREATING=1 + cmd="\$cmd --user=\$(id -u):\$(id -g)" + cmd="\$cmd --entrypoint /bin/bash -it" +elif [[ "\$@" = "export-ALL" ]]; then + local CREATING=1 + cmd="\$cmd --entrypoint /bin/bash" +else + local CREATING=1 + cmd="\$cmd --user=\$(id -u):\$(id -g)" +fi + +# PROJECT - read only! +# assume existing folder PROJECT/Documentation +# absolute path to existing folder PROJECT or current dir +local PROJECT=\${T3DOCS_PROJECT:-\$(pwd)} +cmd="\$cmd -v \$PROJECT:/PROJECT:ro" +if ((\$DEBUG)); then echo "PROJECT......: \$PROJECT"; fi + +# RESULT +# absolute path to existing folder RESULT of (RESULT/Documentation-GENERATED-temp) +local RESULT=\${T3DOCS_RESULT:-\$(pwd)} +# force special name to prevent create/delete disasters +RESULT=\${RESULT}/Documentation-GENERATED-temp +cmd="\$cmd -v \$RESULT:/RESULT" +if ((\$CREATING)); then + if ((\$DEBUG)); then echo creating: mkdir -p "\$RESULT" ; fi + mkdir -p "\$RESULT" 2>/dev/null +fi +if ((\$DEBUG)); then echo "RESULT.......: \$RESULT"; fi + +# TMP +# absolute path to existing folder TMP of (TMP/tmp-GENERATED-temp) +local TMP=\${T3DOCS_TMP:-\$(pwd)} +# force special name to prevent create/delete disasters +TMP=\${TMP}/tmp-GENERATED-temp +if ((\$CREATING)) && [[ -n "\${T3DOCS_TMP}" ]]; then + mkdir -p "\$TMP" 2>/dev/null +fi +if [[ -d "\${TMP}" ]]; then + cmd="\$cmd -v \$TMP:/tmp" + if ((\$CREATING)); then + /bin/bash -c "rm -rf \$TMP/*" + fi + if ((\$DEBUG)); then echo "TMP..........: \$TMP"; fi +fi + +# USERHOME +# absolute path to existing folder 'userhome' +local USERHOME=\${T3DOCS_USERHOME:-\$(pwd)/tmp-GENERATED-userhome} +if [ -d "\$USERHOME" ]; then + cmd="\$cmd -v \$USERHOME:/ALL/userhome" + if ((\$DEBUG)); then echo "USERHOME......: \$USERHOME"; fi +fi + +# MAKEDIR +# absolute path to existing folder MAKEDIR +local MAKEDIR=\${T3DOCS_MAKEDIR:-\$(pwd)/tmp-GENERATED-Makedir} +if [ -d "\$MAKEDIR" ]; then + cmd="\$cmd -v \$MAKEDIR:/ALL/Makedir" + if ((\$DEBUG)); then echo "MAKEDIR......: \$MAKEDIR"; fi +fi + +# MENU +# absolute path to existing folder MENU +local MENU=\${T3DOCS_MENU:-\$(pwd)/tmp-GENERATED-Menu} +if [ -d "\$MENU" ]; then + cmd="\$cmd -v \$MENU:/ALL/Menu" + if ((\$DEBUG)); then echo "MENU.........: \$MENU"; fi +fi + +# VENV (used to be 'Rundir') +# absolute path to existing folder VENV +local VENV=\${T3DOCS_VENV:-\$(pwd)/tmp-GENERATED-venv} +if [ -d "\$VENV" ]; then + cmd="\$cmd -v \$VENV:/ALL/venv" + if ((\$DEBUG)); then echo "VENV.........: \$VENV"; fi +fi + +# THEMES +# absolute path to a folder containing Sphinx themes +local THEMES=\${T3DOCS_THEMES:-\$(pwd)/tmp-GENERATED-Themes} +if [ -d "\$THEMES" ]; then + cmd="\$cmd -v \$THEMES:/THEMES" + if ((\$DEBUG)); then echo "THEMES.......: \$THEMES"; fi +fi + +# TOOLCHAINS +# absolute path to existing folder TOOLCHAINS +local TOOLCHAINS=\${T3DOCS_TOOLCHAINS:-\$(pwd)/tmp-GENERATED-Toolchains} +if [ -d "\$TOOLCHAINS" ]; then + cmd="\$cmd -v \$TOOLCHAINS:/ALL/Toolchains" + if ((\$DEBUG)); then echo "TOOLCHAINS...: \$TOOLCHAINS"; fi +fi + +# WHEELS +# absolute path to a folder containing Python wheel packages +local WHEELS=\${T3DOCS_WHEELS:-\$(pwd)/tmp-GENERATED-Wheels} +if [ -d "\$WHEELS" ]; then + cmd="\$cmd -v \$WHEELS:/WHEELS" + if ((\$DEBUG)); then echo "WHEELS.......: \$WHEELS"; fi +fi + +cmd="\$cmd $OUR_IMAGE" +if ((\$DEBUG)); then echo "OUR_IMAGE....: $OUR_IMAGE"; fi + +# add remaining arguments +if [[ "\$@" = "/bin/bash" ]]; then + true "do nothing here" +elif [[ "\$@" = "/usr/bin/bash" ]]; then + true "do nothing here" +elif [[ "\$@" = "export-ALL" ]]; then + cmd="\$cmd -c \"rsync -a --delete --chown=\$(id -u):\$(id -g) /ALL/ /RESULT/ALL-exported\"" + echo The export will go to: + echo " \$RESULT/ALL-exported" + +else + cmd="\$cmd \$@" + # if script git-restore-mtime exists and '*make*' in args try the command + # See README: get 'git-restore-mtime' from https://github.com/MestreLion/git-tools + if [[ "\$git_restore_mtime" != "" ]] && [[ \$@ =~ .*make.* ]]; then + if ((\$DEBUG)); then + echo \$git_restore_mtime + \$git_restore_mtime + else + \$git_restore_mtime 2>/dev/null + fi + fi +fi +if [[ -w "\$RESULT" ]]; then true + echo "\$cmd" | sed "s/-v /\\\\\\\\\\\\n -v /g" >"\$RESULT/last-docker-run-command-GENERATED.sh.txt" +fi +if ((\$DEBUG || \$DRY_RUN)); then + echo \$cmd | sed "s/-v /\\\\\\\\\\\\n -v /g" +fi +if [[ "\$DRY_RUN" = "0" ]]; then + eval "\$cmd" +fi +} + +echo "This function is now defined FOR THIS terminal window to run ${OUR_IMAGE_TAG}:" +echo " ${DOCKRUN_PREFIX}${OUR_IMAGE_SHORT}" + +EOT \ No newline at end of file