mirror of
https://github.com/overleaf/toolkit.git
synced 2025-04-19 15:28:06 +02:00
Handle overleaf.rc rebranding before version upgrade
This commit is contained in:
parent
b9bc72b5a8
commit
be3b10a182
2 changed files with 10 additions and 3 deletions
|
@ -170,8 +170,6 @@ function handle_image_upgrade() {
|
|||
echo "Over-writing config/version with $SEED_IMAGE_VERSION"
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/version" "$TOOLKIT_ROOT/config/version"
|
||||
|
||||
## Rename variables in overleaf.rc SHARELATEX_ -> OVERLEAF_
|
||||
rebrand_sharelatex_env_variables 'overleaf.rc'
|
||||
if [[ "$IMAGE_VERSION_MAJOR" -le 4 && "$SEED_IMAGE_VERSION_MAJOR" -ge 5 ]]; then
|
||||
echo "Renaming environment variables in config/variables.env and config/overleaf.rc"
|
||||
prompt "Proceed with the environment variable renaming?"
|
||||
|
@ -224,6 +222,11 @@ function handle_git_update() {
|
|||
fi
|
||||
}
|
||||
|
||||
function handle_rc_rebranding() {
|
||||
## Rename variables in overleaf.rc SHARELATEX_ -> OVERLEAF_
|
||||
rebrand_sharelatex_env_variables 'overleaf.rc' silent_if_no_match
|
||||
}
|
||||
|
||||
function __main__() {
|
||||
if [[ "${1:-null}" == "help" ]] \
|
||||
|| [[ "${1:-null}" == "--help" ]] ; then
|
||||
|
@ -233,6 +236,7 @@ function __main__() {
|
|||
handle_git_update
|
||||
read_seed_image_version
|
||||
read_image_version
|
||||
handle_rc_rebranding
|
||||
handle_image_upgrade
|
||||
|
||||
echo "Done"
|
||||
|
|
|
@ -28,6 +28,7 @@ prompt() {
|
|||
|
||||
rebrand_sharelatex_env_variables() {
|
||||
local filename=$1
|
||||
local silent=${2:-no}
|
||||
sharelatex_occurrences=$(set +o pipefail && grep -o "SHARELATEX_" "$TOOLKIT_ROOT/config/$filename" | wc -l | sed 's/ //g')
|
||||
if [ "$sharelatex_occurrences" -gt 0 ]; then
|
||||
echo "Found $sharelatex_occurrences lines with SHARELATEX_ in $filename"
|
||||
|
@ -38,6 +39,8 @@ rebrand_sharelatex_env_variables() {
|
|||
sed -i "s/SHARELATEX_/OVERLEAF_/g" "$TOOLKIT_ROOT/config/$filename"
|
||||
echo "Updated $sharelatex_occurrences lines in $TOOLKIT_ROOT/config/$filename"
|
||||
else
|
||||
echo "No 'SHARELATEX_' ocurrences found in config/$filename"
|
||||
if [[ "$silent" != "silent_if_no_match" ]]; then
|
||||
echo "No 'SHARELATEX_' occurrences found in config/$filename"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue