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

32 lines
880 B
Text
Raw Permalink Normal View History

2020-06-02 14:20:23 +01:00
#! /usr/bin/env bash
set -euo pipefail
2020-07-16 10:56:44 +01:00
2020-07-16 09:48:00 +01:00
#### 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#./}"
}
2020-07-16 09:48:00 +01:00
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
2020-06-02 14:20:23 +01:00
function check_config() {
2020-07-16 09:48:00 +01:00
if [[ ! -f "$TOOLKIT_ROOT/config/overleaf.rc" ]] \
|| [[ ! -f "$TOOLKIT_ROOT/config/variables.env" ]]; then
echo "Config files not found! exiting"
exit 1
fi
}
2020-06-02 14:20:23 +01:00
function __main__() {
check_config
2020-07-16 09:48:00 +01:00
exec "$TOOLKIT_ROOT/bin/docker-compose" up
2020-06-02 14:20:23 +01:00
}
__main__ "$@"