summaryrefslogtreecommitdiff
path: root/update-submodule
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-02-11 15:03:35 +0100
committerErich Eckner <git@eckner.net>2020-02-11 15:03:35 +0100
commit0e2792533669e59c7134d976e38109d639135a81 (patch)
tree295619ae90113682b7e4259756436e6fe11e524a /update-submodule
parent21f2a6698b26a5d55579435f811334d17d6a6263 (diff)
downloadarchlinuxewe-0e2792533669e59c7134d976e38109d639135a81.tar.xz
update-submodule neu
Diffstat (limited to 'update-submodule')
-rwxr-xr-xupdate-submodule25
1 files changed, 25 insertions, 0 deletions
diff --git a/update-submodule b/update-submodule
new file mode 100755
index 000000000..3bd04b7a4
--- /dev/null
+++ b/update-submodule
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+url="$1"
+pkgSrcDir="${url%% *}"
+url="${url#${path} }"
+submoduleDir="${url%% *}"
+url="${url#${path} }"
+path="${url%% *}"
+url="${url#${path} }"
+
+if [ -n "$(ls -A "${path}")" ]; then
+ git -C "${pkgSrcDir}" submodule update 2>/dev/null || true
+ exit
+fi
+mkdir -p "${path}"
+if [ -n "${submoduleDir}" ]; then
+ upstream="${submoduleDir}/${path}"
+ if [ ! -d "${upstream}" ]; then
+ git clone -q "${url}" "${upstream}"
+ fi
+else
+ upstream="${pkgSrcDir}/${path}"
+fi
+git -C "${upstream}" pull -q --ff-only
+git clone -q "${upstream}" "${path}"