From 0e2792533669e59c7134d976e38109d639135a81 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 11 Feb 2020 15:03:35 +0100 Subject: update-submodule neu --- update-submodule | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 update-submodule (limited to 'update-submodule') 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}" -- cgit v1.2.3-54-g00ecf