summaryrefslogtreecommitdiff
path: root/web-server/update-scripts/update-all-gnu-sv-www-repo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'web-server/update-scripts/update-all-gnu-sv-www-repo.sh')
-rwxr-xr-xweb-server/update-scripts/update-all-gnu-sv-www-repo.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/web-server/update-scripts/update-all-gnu-sv-www-repo.sh b/web-server/update-scripts/update-all-gnu-sv-www-repo.sh
new file mode 100755
index 0000000..350e9cb
--- /dev/null
+++ b/web-server/update-scripts/update-all-gnu-sv-www-repo.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# Copyright (C) 2014 Assaf Gordon (assafgordon@gmail.com)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+##
+## This script pulls updates for all WWW-GIT repositories,
+## regardless of whether they were recently updated or not.
+##
+
+die()
+{
+ BASE=$(basename "$0")
+ echo "$BASE: error: $@" >&2
+ exit 1
+}
+
+log()
+{
+ DATE=$(date +%F-%H%M%S)
+ echo "$DATE: $@" >&2
+}
+
+# Directory containing each repository
+GITDIR=/var/lib/savannah-checkouts/
+
+for PROJ in $(find "$GITDIR" -maxdepth 1 -type d | sed 1d | sort) ;
+do
+ cd "$PROJ"
+
+ git fetch --quiet \
+ || log "failed to git-fetch in '$PROJ'"
+
+ ## Empty repository? don't try to pull
+ git rev-parse HEAD 1>/dev/null 2>&1 \
+ || continue
+
+ git pull --quiet \
+ || log "failed to git-pull in '$PROJ'"
+done
+
+## vim: set shiftwidth=4:
+## vim: set tabstop=4:
+## vim: set expandtab: