aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bin/update-git-submodules.sh')
-rwxr-xr-xbin/update-git-submodules.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/bin/update-git-submodules.sh b/bin/update-git-submodules.sh
new file mode 100755
index 0000000..bb796a5
--- /dev/null
+++ b/bin/update-git-submodules.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+SUBMODULES=("_data/news" "glep")
+
+# Ensure the script is in the base of the project directory.
+cd "$(dirname "$0")"/.. || exit
+
+echo -n 'Updating git submodules'
+
+# Verify git exists at runtime or safely skip this update
+if ! command -v git &> /dev/null; then
+ echo "...skipped (git is not detected on the PATH)."
+ exit
+fi
+
+for module in "${SUBMODULES[@]}"; do
+ printf ' %s' "${module}"
+ if [ -d "${module}/.git" ]; then
+ git submodule update --quiet --depth=1 "${module}"
+ else
+ git submodule update --quiet --depth=1 --init "${module}"
+ fi
+ done
+
+echo '...done.'