|
|
@ -2,26 +2,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
# --- VARIABLES ---
|
|
|
|
# --- VARIABLES ---
|
|
|
|
# Load variables
|
|
|
|
# Load variables
|
|
|
|
source $PWD/info.env
|
|
|
|
source $WORKDIR/info.env
|
|
|
|
|
|
|
|
|
|
|
|
# Check if certain vars are overwritten, set them if missing
|
|
|
|
# Check if certain vars are overwritten, set them if missing
|
|
|
|
if [ "${NAME}" = "" ]; then
|
|
|
|
if [ "${NAME}" = "" ]; then
|
|
|
|
NAME="$(basename $PWD)"
|
|
|
|
NAME="$(basename $WORKDIR)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
export NAME
|
|
|
|
export NAME
|
|
|
|
printf "Name: ${NAME}\n"
|
|
|
|
printf "Name: ${NAME}\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repositoryFolder="$WORKDIR/.build/repository"
|
|
|
|
|
|
|
|
|
|
|
|
# --- SOURCES ---
|
|
|
|
# --- SOURCES ---
|
|
|
|
alias git="git -C .build/repository"
|
|
|
|
|
|
|
|
# Get sources locally
|
|
|
|
# Get sources locally
|
|
|
|
if ! [ -d .build/repository ]; then
|
|
|
|
if ! [ -d "$repositoryFolder" ]; then
|
|
|
|
git clone "${GIT_REPOSITORY}" .build/repository
|
|
|
|
git clone "${GIT_REPOSITORY}" .
|
|
|
|
else
|
|
|
|
cloned=True
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Change into repository
|
|
|
|
|
|
|
|
cd "$repositoryFolder"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$cloned" != True ]; then
|
|
|
|
# Checkout default-branch in case GIT_CHECKOUT was different
|
|
|
|
# Checkout default-branch in case GIT_CHECKOUT was different
|
|
|
|
defaultBranch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
|
|
|
|
defaultBranch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
|
|
|
|
git checkout "${defaultBranch}"
|
|
|
|
git checkout "${defaultBranch}"
|
|
|
|
|
|
|
|
|
|
|
|
git pull # Get changes
|
|
|
|
git pull # Get changes
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|