diff options
-rw-r--r-- | config.sh | 2 | ||||
-rwxr-xr-x | dscip | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/config.sh b/config.sh index c78e95e..321235b 100644 --- a/config.sh +++ b/config.sh @@ -7,7 +7,7 @@ DSCIP_GITREPO="https://www.example.com/example/example.git" DSCIP_GITMODE="clone" # Branch to check # DSCIP_BRANCH="master" -WORKING_DIRECTORY="$(dirname $(realpath $0))" +WORKING_DIRECTORY="$(pwd -P)" # Commands to run before building. # DSCIP_PRE_CMD="$WORKING_DIRECTORY/pre.sh" # Commands to run to build program. # diff --git a/dscip b/dscip index db7726e..61208a0 100755 --- a/dscip +++ b/dscip @@ -17,7 +17,8 @@ ################################################################################ set -e -. "$(dirname "$(realpath "$0")")/config.sh" +cd "$(dirname "$0")" +. "$(pwd -P)/config.sh" ################################################################################ @@ -65,10 +66,10 @@ echo "DSCIP_OUTPUT_TO=$DSCIP_OUTPUT_TO" build () { if [ "$DSCIP_GITMODE" = "clone" ]; then rm -rf "$WORKING_DIRECTORY/wrkdir" # Clean Up # - git clone -b "$DSCIP_BRANCH" "$DSCIP_GITREPO" wrkdir >> "$DSCIP_OUTPUT_TO" 2>&1 # Clone git # + git clone --depth 1 -b "$DSCIP_BRANCH" "$DSCIP_GITREPO" wrkdir >> "$DSCIP_OUTPUT_TO" 2>&1 # Clone git # elif [ "$DSCIP_GITMODE" = "pull" ]; then if [ ! -d "$WORKING_DIRECTORY/wrkdir" ]; then - git clone -b "$DSCIP_BRANCH" "$DSCIP_GITREPO" wrkdir >> "$DSCIP_OUTPUT_TO" 2>&1 + git clone --depth 1 -b "$DSCIP_BRANCH" "$DSCIP_GITREPO" wrkdir >> "$DSCIP_OUTPUT_TO" 2>&1 fi cd wrkdir git pull >> "$DSCIP_OUTPUT_TO" 2>&1 @@ -79,13 +80,13 @@ build () { { cd "$WORKING_DIRECTORY/wrkdir"; echo "Running pre-build commands..."; - $DSCIP_PRE_CMD; + "$DSCIP_PRE_CMD"; echo "Running build commands..."; cd "$WORKING_DIRECTORY/wrkdir"; - $DSCIP_BUILD_CMD; + "$DSCIP_BUILD_CMD"; echo "Running post-build commands..."; cd "$WORKING_DIRECTORY/wrkdir"; - $DSCIP_POST_CMD; + "$DSCIP_POST_CMD"; } >> "$DSCIP_OUTPUT_TO" 2>&1 echo "$CURRENT_COMMIT" > "$WORKING_DIRECTORY/LAST_COMMIT" # Save commit # } |