1
0
Fork 0
mirror of https://github.com/overleaf/toolkit.git synced 2025-04-20 15:58:06 +02:00

Change name of var to TOOLKIT_ROOT

This commit is contained in:
Shane Kilkelly 2020-07-15 15:45:59 +01:00
parent 3119f42407
commit abbab61475

View file

@ -2,9 +2,14 @@
set -euo pipefail
#### Detect Toolkit Project Root ####
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
PROJECT_ROOT="$(realpath "$SCRIPT_DIR/..")"
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
function usage() {
echo "Usage: bin/backup-config [OPTIONS] [DESTINATION]"
@ -47,11 +52,11 @@ function __main__() {
destination="$1"
if [[ "$mode" == "copy" ]]; then
cp -r "$PROJECT_ROOT/config" "$destination"
cp -r "$TOOLKIT_ROOT/config" "$destination"
elif [[ "$mode" == "zip" ]]; then
zip -j -r "$destination" "$PROJECT_ROOT/config"
zip -j -r "$destination" "$TOOLKIT_ROOT/config"
elif [[ "$mode" == "tar" ]]; then
tar -cf "$destination" -C "$PROJECT_ROOT" config
tar -cf "$destination" -C "$TOOLKIT_ROOT" config
else
echo "Error: unrecognized mode '$mode'"
exit 1