summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xarchPackagesUpdate33
-rwxr-xr-xupdate-submodule25
2 files changed, 31 insertions, 27 deletions
diff --git a/archPackagesUpdate b/archPackagesUpdate
index 31366436..d1636341 100755
--- a/archPackagesUpdate
+++ b/archPackagesUpdate
@@ -263,6 +263,7 @@ unset verss
unset repos
if [ -f '.gitmodules' ]; then
+ >&2 printf 'updating submodules ...'
sed -n '
/^\s*path = /{
N
@@ -271,35 +272,13 @@ if [ -f '.gitmodules' ]; then
s,ssh://aur@aur.archlinux.org/,https://aur.archlinux.org/,
p
}
- ' '.gitmodules' | \
- while read -r path url; do
- if [ -n "$(ls -A "${path}")" ]; then
- git submodule update -- "${path}"
- continue
- fi
- mkdir -p "${path}"
- >&2 printf 'submodule %s: ' "${path}"
- if [ -n "${submoduleDir}" ]; then
- upstream="${submoduleDir}/${path}"
- >&2 printf ' cached'
- if [ ! -d "${upstream}" ]; then
- >&2 printf ', cloning ...'
- git clone -q "${url}" "${upstream}"
- >&2 printf ' done'
- fi
- else
- upstream="${pkgSrcDir}/${path}"
- >&2 printf ' true submodule'
- fi
- >&2 printf ', pulling ...'
- git -C "${upstream}" pull -q --ff-only
- >&2 printf ' done'
- >&2 printf ', cloning ...'
- git clone -q "${upstream}" "${path}"
- >&2 printf ' done.\n'
- done
+ ' '.gitmodules' \
+ | parallel -j0 "${pkgSrcDir}/update-submodule" "${pkgSrcDir}" "${submoduleDir}"
+ >&2 printf ' done.\n'
fi
+exit 42
+
if ${aufRechenknecht}; then
# collect packages
diff --git a/update-submodule b/update-submodule
new file mode 100755
index 00000000..3bd04b7a
--- /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}"