aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMatthew Marchese <maffblaster@gentoo.org>2023-05-02 03:30:20 -0700
committerMatthew Marchese <maffblaster@gentoo.org>2023-05-02 03:30:20 -0700
commit77b40bb64f15b10dfe365b4006f77b7e49260873 (patch)
tree556833d3aa48de4a128aa0cf9907519f32b6ae25 /bin
parentREADME.md: Add git submodule details. (diff)
downloadwww-77b40bb64f15b10dfe365b4006f77b7e49260873.tar.gz
www-77b40bb64f15b10dfe365b4006f77b7e49260873.tar.bz2
www-77b40bb64f15b10dfe365b4006f77b7e49260873.zip
update.sh: Automate installation of git submods.
This change should pull in new changes from GLEPS and NEWS items automatically in the future. A runtime check of git is performed; the new script should safely exit git is not detected, which _could_ be the case for a dedicated web host. Signed-off-by: Matthew Marchese <maffblaster@gentoo.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update-git-submodules.sh25
-rwxr-xr-xbin/update.sh3
2 files changed, 27 insertions, 1 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.'
diff --git a/bin/update.sh b/bin/update.sh
index 1ba3e48..20d02c6 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -10,6 +10,7 @@ bin/update-keys.sh || exit 1
bin/update-mirrors.sh || exit 1
bin/update-packages.sh || exit 1
bin/update-planet.sh || exit 1
-bin/update-use.sh || exit 1
+bin/update-use.sh || exit 1
bin/update-userinfo.sh || exit 1
bin/update-wiki.sh || exit 1
+bin/update-git-submodules.sh || exit 1 \ No newline at end of file