summaryrefslogtreecommitdiff
path: root/external/ios/build_unbound.sh
diff options
context:
space:
mode:
authorcyan <cyjan@mrcyjanek.net>2024-04-12 19:03:24 +0200
committerGitHub <noreply@github.com>2024-04-12 19:03:24 +0200
commit52db5c78f8d94b7d30c27e08a94545fb8934661f (patch)
tree01eef3d727ce4f16700c1027ec27cf58f3cf3eeb /external/ios/build_unbound.sh
parentf5a6dbdd8ef45493a24c1a6130ad4168ca1dddaf (diff)
parentae57e3dc6f45f4ec9f3bd07a15e45e9e5a10ae48 (diff)
Merge pull request #1 from cypherstack/scripts
Windows fix: do not fail on `git clone` if repo already exists
Diffstat (limited to 'external/ios/build_unbound.sh')
-rwxr-xr-xexternal/ios/build_unbound.sh23
1 files changed, 20 insertions, 3 deletions
diff --git a/external/ios/build_unbound.sh b/external/ios/build_unbound.sh
index 86d1007..02f12d7 100755
--- a/external/ios/build_unbound.sh
+++ b/external/ios/build_unbound.sh
@@ -7,13 +7,30 @@ set -e
UNBOUND_VERSION=release-1.16.2
UNBOUND_HASH="cbed768b8ff9bfcf11089a5f1699b7e5707f1ea5"
UNBOUND_URL="https://www.nlnetlabs.nl/downloads/unbound/unbound-${UNBOUND_VERSION}.tar.gz"
+UNBOUND_GIT_URL="https://github.com/NLnetLabs/unbound.git"
UNBOUND_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/unbound-1.16.2"
echo "============================ Unbound ============================"
rm -rf ${UNBOUND_DIR_PATH}
-git clone https://github.com/NLnetLabs/unbound.git -b ${UNBOUND_VERSION} ${UNBOUND_DIR_PATH}
-cd $UNBOUND_DIR_PATH
-test `git rev-parse HEAD` = ${UNBOUND_HASH} || exit 1
+
+# Check if the directory already exists.
+if [ -d "$UNBOUND_DIR_PATH" ]; then
+ echo "Unbound directory already exists."
+else
+ echo "Cloning Unbound from $Unbound_URL"
+ git clone $UNBOUND_GIT_URL -b ${UNBOUND_VERSION} ${UNBOUND_DIR_PATH}
+fi
+
+# Verify if the repository was cloned successfully.
+if [ -d "$UNBOUND_DIR_PATH/.git" ]; then
+ echo "Unbound repository cloned successfully."
+ cd $UNBOUND_DIR_PATH
+ git checkout $UNBOUND_VERSION # Or UNBOUND_HASH.
+ test `git rev-parse HEAD` = ${UNBOUND_HASH} || exit 1
+else
+ echo "Failed to clone Unbound repository. Exiting."
+ exit 1
+fi
export IOS_SDK=iPhone
export IOS_CPU=arm64