mirror of
https://github.com/overleaf/toolkit.git
synced 2025-04-19 15:28:06 +02:00
Check on variable rebranding from bin/doctor
This commit is contained in:
parent
84393ce277
commit
b5d75d9342
3 changed files with 41 additions and 40 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue