mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-07-19 07:21:35 +00:00
feat: build libsurvive script; common clone or pull script
This commit is contained in:
parent
3f727cb3f2
commit
4f43920c27
3 changed files with 46 additions and 14 deletions
31
scripts/_clone_or_pull.sh
Executable file
31
scripts/_clone_or_pull.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
# exit on error
|
||||
# echo commands
|
||||
set -ev
|
||||
|
||||
GIT_URL=$1
|
||||
REPO_DIR=$2
|
||||
|
||||
_usage() {
|
||||
echo "Usage: $0 GIT_URL REPO_DIR"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ -z $REPO_DIR ]]; then
|
||||
_usage
|
||||
fi
|
||||
|
||||
if [[ -z $GIT_URL ]]; then
|
||||
_usage
|
||||
fi
|
||||
|
||||
if [[ -d "$REPO_DIR" ]]; then
|
||||
if [[ ! -d "$REPO_DIR/.git" ]]; then
|
||||
echo "Error: $REPO_DIR exists but is not a git repository"
|
||||
exit 1
|
||||
fi
|
||||
git -C "$REPO_DIR" pull
|
||||
else
|
||||
git clone "$GIT_URL" "$REPO_DIR" --recurse-submodules
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue