mirror of
https://github.com/overleaf/toolkit.git
synced 2025-04-19 23:38:06 +02:00
WIP: make script work regardless of PWD
This commit is contained in:
parent
32c5d51eab
commit
3119f42407
1 changed files with 7 additions and 3 deletions
|
@ -2,6 +2,10 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
PROJECT_ROOT="$(realpath "$SCRIPT_DIR/..")"
|
||||
|
||||
function usage() {
|
||||
echo "Usage: bin/backup-config [OPTIONS] [DESTINATION]"
|
||||
echo ""
|
||||
|
@ -43,11 +47,11 @@ function __main__() {
|
|||
destination="$1"
|
||||
|
||||
if [[ "$mode" == "copy" ]]; then
|
||||
cp -r config "$destination"
|
||||
cp -r "$PROJECT_ROOT/config" "$destination"
|
||||
elif [[ "$mode" == "zip" ]]; then
|
||||
zip -r "$destination" config
|
||||
zip -j -r "$destination" "$PROJECT_ROOT/config"
|
||||
elif [[ "$mode" == "tar" ]]; then
|
||||
tar -cf "$destination" config/*
|
||||
tar -cf "$destination" -C "$PROJECT_ROOT" config
|
||||
else
|
||||
echo "Error: unrecognized mode '$mode'"
|
||||
exit 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue