mirror of
https://github.com/overleaf/toolkit.git
synced 2025-04-20 15:58:06 +02:00
Fix pathing in bin/init
This commit is contained in:
parent
049014fb20
commit
684a08806b
1 changed files with 15 additions and 6 deletions
21
bin/init
21
bin/init
|
@ -2,6 +2,15 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
#### Detect Toolkit Project Root ####
|
||||
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
|
||||
|
||||
function usage() {
|
||||
echo "Usage: bin/init"
|
||||
echo ""
|
||||
|
@ -10,9 +19,9 @@ function usage() {
|
|||
}
|
||||
|
||||
function check_existing_config() {
|
||||
if [[ -f ./config/overleaf.rc ]] \
|
||||
|| [[ -f ./config/variables.env ]] \
|
||||
|| [[ -f ./config/version ]]; then
|
||||
if [[ -f "$TOOLKIT_ROOT/config/overleaf.rc" ]] \
|
||||
|| [[ -f "$TOOLKIT_ROOT/config/variables.env" ]] \
|
||||
|| [[ -f "$TOOLKIT_ROOT/config/version" ]]; then
|
||||
echo "ERROR: Config files already exist, exiting "
|
||||
exit 1
|
||||
fi
|
||||
|
@ -20,9 +29,9 @@ function check_existing_config() {
|
|||
|
||||
function set_up_config_files() {
|
||||
echo "Copying config files to 'config/'"
|
||||
cp ./lib/config-seed/overleaf.rc ./config/
|
||||
cp ./lib/config-seed/variables.env ./config/
|
||||
cp ./lib/config-seed/version ./config/
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/overleaf.rc" "$TOOLKIT_ROOT/config/"
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/variables.env" "$TOOLKIT_ROOT/config/"
|
||||
cp "$TOOLKIT_ROOT/lib/config-seed/version" "$TOOLKIT_ROOT/config/"
|
||||
}
|
||||
|
||||
function __main__() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue