1
0
Fork 0
mirror of https://github.com/overleaf/toolkit.git synced 2025-04-18 14:58:21 +02:00
overleaf-toolkit/bin/rename-rc-vars
Miguel Serrano e2b99f150f
Scripts to update config/overleaf.rc and config-seed rebrand (#217)
* Add scripts to rebrand variables.env and overleaf.rc

* Update bin/upgrade to prompt for config file rebrand

* Update bin/up to check for correct variable prefix

Ensures SHARELATEX_ is in place for version <= 4.x, and
OVERLEAF_ for version >= 5.x

* Rebrand variables for bin/docker-compose

Updates docker-compose.base.yml and sibling containers
base file with the changes in the script

* Update bin/doctor to support OVERLEAF_ prefix

* Update documentation with the OVERLEAF_ prefix

* Rebrand variables.env and overleaf.rc in config-seed

* Prepare config/version and CHANGELOG for release (WIP)

* Fix script documentation

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* Fix doctor logs

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* Remove unnecessary fallbacks to SHARELATEX_ vars

* SEt OVERLEAF_DATA_PATH to data/overleaf

* Remove duplicated environment entries

* Moved prefix brand checs from bin/up to bin/docker-compose

* Move set +o pipefail into subshell commands

* Use separate legacy compose files for required SHARELATEX_ vars

* Handle overleaf.rc rebranding before version upgrade

* Group output from rebranding process

* Move prompt for rebranding into helper function

* Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs

* Print expected prefix when checking variables.env

* Print number of mismatching variables in overleaf.rc

* Check on variable rebranding from bin/doctor

* Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc

* Update filesystem paths in bin/logs and docs

* Flag old TEXMFVAR entry in config/variables.env

REF: 1829e7ee2a

* Update config-seed version to 5.0.1 and changelog

---------

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00

42 lines
1.1 KiB
Bash
Executable file

#! /usr/bin/env bash
# shellcheck source-path=..
set -euo pipefail
#### Detect Toolkit Project Root ####
# if realpath is not available, create a semi-equivalent function
command -v realpath >/dev/null 2>&1 || realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")"
if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then
echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')"
exit 1
fi
source "$TOOLKIT_ROOT/lib/shared-functions.sh"
function usage() {
echo "Usage: bin/rename-rc-vars"
echo ""
echo "Updates config/overleaf.rc to ensure variables are renamed from 'SHARELATEX_' to 'OVERLEAF_'"
echo ""
}
function __main__() {
if [[ "${1:-null}" == "help" ]] || [[ "${1:-null}" == "--help" ]]; then
usage
exit
fi
echo "This script will update your config/overleaf.rc."
echo "We recommend backing up your config with bin/backup-config."
rebrand_sharelatex_env_variables 'overleaf.rc'
echo "Done."
}
__main__ "$@"