]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
update.sh: Add, updates git repositories.
authorSimon Ruderich <simon@ruderich.org>
Tue, 30 Mar 2010 22:23:18 +0000 (00:23 +0200)
committerSimon Ruderich <simon@ruderich.org>
Tue, 30 Mar 2010 22:23:18 +0000 (00:23 +0200)
update.sh [new file with mode: 0755]

diff --git a/update.sh b/update.sh
new file mode 100755 (executable)
index 0000000..d6a1b4d
--- /dev/null
+++ b/update.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Update all git repositories to the latest available changes. This should be
+# run on remote servers after new commits where pushed to them.
+
+
+pwd=`pwd`
+for path in `find . -name .git -type d`; do
+    cd $path; cd ..
+
+    # Merge all branches into master if it's checked out. Then run ./setup.sh
+    # to make sure all configuration files get updated.
+    if `git branch | grep *\ master > /dev/null`; then
+        echo $path:
+        for branch in `git branch -a | grep remotes`; do
+            echo "  merging: $branch"
+            git merge $branch
+        done
+        echo "  running ./setup.sh"
+        ./setup.sh > /dev/null || exit 1
+    fi
+
+    cd $pwd
+done