diff options
author | Erich Eckner <git@eckner.net> | 2020-02-11 15:03:35 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-02-11 15:03:35 +0100 |
commit | 0e2792533669e59c7134d976e38109d639135a81 (patch) | |
tree | 295619ae90113682b7e4259756436e6fe11e524a /update-submodule | |
parent | 21f2a6698b26a5d55579435f811334d17d6a6263 (diff) | |
download | archlinuxewe-0e2792533669e59c7134d976e38109d639135a81.tar.xz |
update-submodule neu
Diffstat (limited to 'update-submodule')
-rwxr-xr-x | update-submodule | 25 |
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}" |