diff --git a/bin/docker-compose b/bin/docker-compose index 8c4af80..3c58d05 100755 --- a/bin/docker-compose +++ b/bin/docker-compose @@ -18,46 +18,6 @@ fi source "$TOOLKIT_ROOT/lib/shared-functions.sh" -function check_sharelatex_env_vars() { - local rc_occurrences=$(set +o pipefail && grep -o SHARELATEX_ "$TOOLKIT_ROOT/config/overleaf.rc" | wc -l | sed 's/ //g') - - if [ "$rc_occurrences" -gt 0 ]; then - echo "Rebranding from ShareLaTeX to Overleaf" - echo " The Toolkit has adopted to Overleaf brand for its variables." - echo " Your config/overleaf.rc still has $rc_occurrences variables using the previous ShareLaTeX brand." - echo " Moving forward the 'SHARELATEX_' prefixed variables must be renamed to 'OVERLEAF_'." - echo " You can migrate your config/overleaf.rc to use the Overleaf brand by running:" - echo "" - echo " toolkit$ bin/rename-rc-vars" - echo "" - exit 1 - fi - - local expected_prefix="OVERLEAF_" - local invalid_prefix="SHARELATEX_" - if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then - expected_prefix="SHARELATEX_" - invalid_prefix="OVERLEAF_" - fi - - local env_occurrences=$(set +o pipefail && grep -o "$invalid_prefix" "$TOOLKIT_ROOT/config/variables.env" | wc -l | sed 's/ //g') - - if [ "$env_occurrences" -gt 0 ]; then - echo "Rebranding from ShareLaTeX to Overleaf" - echo " Starting with Overleaf CE and Server Pro version 5.0.0 the environment variables will use the Overleaf brand." - echo " Previous versions used the ShareLaTeX brand for environment variables." - echo " Your config/variables.env has $env_occurrences entries matching '$invalid_prefix', expected prefix '$expected_prefix'." - echo " Please align your config/version with the naming scheme of variables in config/variables.env." - if [[ ! "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then - echo " You can migrate your config/variables.env to use the Overleaf brand by running:" - echo "" - echo " toolkit$ bin/rename-env-vars-5-0" - echo "" - fi - exit 1 - fi -} - function build_environment() { canonicalize_data_paths set_base_vars diff --git a/bin/doctor b/bin/doctor index 7f7884f..fde70f8 100755 --- a/bin/doctor +++ b/bin/doctor @@ -463,6 +463,7 @@ function cleanup() { function __main__() { read_image_version print_section_separator "Overleaf Doctor" + check_sharelatex_env_vars check_host_information check_dependencies check_docker_daemon diff --git a/lib/shared-functions.sh b/lib/shared-functions.sh index c9e151f..cf034a7 100644 --- a/lib/shared-functions.sh +++ b/lib/shared-functions.sh @@ -49,3 +49,43 @@ rebrand_sharelatex_env_variables() { fi fi } + +function check_sharelatex_env_vars() { + local rc_occurrences=$(set +o pipefail && grep -o SHARELATEX_ "$TOOLKIT_ROOT/config/overleaf.rc" | wc -l | sed 's/ //g') + + if [ "$rc_occurrences" -gt 0 ]; then + echo "Rebranding from ShareLaTeX to Overleaf" + echo " The Toolkit has adopted to Overleaf brand for its variables." + echo " Your config/overleaf.rc still has $rc_occurrences variables using the previous ShareLaTeX brand." + echo " Moving forward the 'SHARELATEX_' prefixed variables must be renamed to 'OVERLEAF_'." + echo " You can migrate your config/overleaf.rc to use the Overleaf brand by running:" + echo "" + echo " toolkit$ bin/rename-rc-vars" + echo "" + exit 1 + fi + + local expected_prefix="OVERLEAF_" + local invalid_prefix="SHARELATEX_" + if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then + expected_prefix="SHARELATEX_" + invalid_prefix="OVERLEAF_" + fi + + local env_occurrences=$(set +o pipefail && grep -o "$invalid_prefix" "$TOOLKIT_ROOT/config/variables.env" | wc -l | sed 's/ //g') + + if [ "$env_occurrences" -gt 0 ]; then + echo "Rebranding from ShareLaTeX to Overleaf" + echo " Starting with Overleaf CE and Server Pro version 5.0.0 the environment variables will use the Overleaf brand." + echo " Previous versions used the ShareLaTeX brand for environment variables." + echo " Your config/variables.env has $env_occurrences entries matching '$invalid_prefix', expected prefix '$expected_prefix'." + echo " Please align your config/version with the naming scheme of variables in config/variables.env." + if [[ ! "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then + echo " You can migrate your config/variables.env to use the Overleaf brand by running:" + echo "" + echo " toolkit$ bin/rename-env-vars-5-0" + echo "" + fi + exit 1 + fi +}