mirror of
https://github.com/overleaf/toolkit.git
synced 2025-04-19 15:28:06 +02:00
preventing variables.env to backup when not needed
This commit is contained in:
parent
562742f350
commit
9c5ac3a568
1 changed files with 14 additions and 5 deletions
|
@ -27,9 +27,18 @@ prompt() {
|
|||
}
|
||||
|
||||
rebrand_sharelatex_env_variables() {
|
||||
local timestamp=$(date "+%Y.%m.%d-%H.%M.%S")
|
||||
echo "Creating backup file config/__old-variables.env.$timestamp"
|
||||
cp config/variables.env config/__old-variables.env.$timestamp
|
||||
echo "Replacing 'SHARELATEX_' with 'OVERLEAF_' in config/variables.env"
|
||||
sed -i "s/SHARELATEX_/OVERLEAF_/g" "$TOOLKIT_ROOT/config/variables.env"
|
||||
set +o pipefail
|
||||
sharelatex_occurrences=$(grep -o "SHARELATEX_" "$TOOLKIT_ROOT/config/variables.env" | wc -l | sed 's/ //g')
|
||||
set -o pipefail
|
||||
if [ "$sharelatex_occurrences" -gt 0 ]; then
|
||||
echo "Found $sharelatex_occurrences lines with SHARELATEX_"
|
||||
local timestamp=$(date "+%Y.%m.%d-%H.%M.%S")
|
||||
echo "Creating backup file config/__old-variables.env.$timestamp"
|
||||
cp config/variables.env config/__old-variables.env.$timestamp
|
||||
echo "Replacing 'SHARELATEX_' with 'OVERLEAF_' in config/variables.env"
|
||||
sed -i "s/SHARELATEX_/OVERLEAF_/g" "$TOOLKIT_ROOT/config/variables.env"
|
||||
echo "Updated $sharelatex_occurrences lines in $TOOLKIT_ROOT/config/variables.env"
|
||||
else
|
||||
echo "No 'SHARELATEX_' ocurrences found in config/variables.env"
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue