about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-07-14 04:16:22 -0400
committerCharadon <dev@iotib.net>2022-07-14 04:16:22 -0400
commitfbccc58abece3004b7d4912d5df331292db6dcaf (patch)
tree8a45ff1e08ebb2da4e63bbb5f43817117b79698a
parentf45c47112bd5561dc74797bc7bac02dc59d92bda (diff)
downloaddscip-fbccc58abece3004b7d4912d5df331292db6dcaf.tar.gz
Fixed portability issue, and made git only clone the most recent commit with no history.
-rw-r--r--config.sh2
-rwxr-xr-xdscip13
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 #
 }