1
0
Fork 0
mirror of https://github.com/overleaf/toolkit.git synced 2025-04-19 23:38:06 +02:00

add timestamp to backup file

This commit is contained in:
mserranom 2024-02-01 11:32:12 +01:00
parent 335c94886a
commit 8b9fc04f55
2 changed files with 6 additions and 4 deletions

View file

@ -36,8 +36,9 @@ function __main__() {
echo "We recommend backing up your config with bin/backup-config."
prompt "Do you want to continue?"
echo "Creating backup file config/__old-variables.env"
cp config/variables.env config/__old-variables.env
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"

View file

@ -161,8 +161,9 @@ function handle_image_upgrade() {
if [[ "$IMAGE_VERSION_MAJOR" -le 4 && "$SEED_IMAGE_VERSION_MAJOR" -ge 5 ]]; then
echo "Renaming environment variables in config/variables.env"
prompt "Proceed with the environment variable renaming?"
echo "Backing up old variables.env file to config/__old-variables.env"
cp "$TOOLKIT_ROOT/config/variables.env" "$TOOLKIT_ROOT/config/__old-variables.env"
local timestamp=$(date "+%Y.%m.%d-%H.%M.%S")
echo "Backing up old variables.env file to config/__old-variables.env.$timestamp"
cp "$TOOLKIT_ROOT/config/variables.env" "$TOOLKIT_ROOT/config/__old-variables.env.$timestamp"
sed -i "s/SHARELATEX_/OVERLEAF_/g" "$TOOLKIT_ROOT/config/variables.env"
fi