fixed enc repo to always update
[deploy-hooks.git] / enc.git / post-update
diff --git a/enc.git/post-update b/enc.git/post-update
new file mode 100644 (file)
index 0000000..bbb570c
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+#
+# An example hook script to prepare a packed repository for use over
+# dumb transports.
+#
+# To enable this hook, rename this file to "post-update".
+
+local_base=/home/git/local/checkouts/enc
+
+unset GIT_DIR
+echo Deploying files to static...
+
+echo $1
+
+target=enc-dev0
+case $1 in
+  refs/heads/master)
+         target=enc-dev0
+    branch=master
+       ;;
+  refs/heads/next-version)
+    target=enc-dev0
+    branch=next-version
+  ;;
+  refs/heads/live)
+         target=emailselfdefense.fsf.org
+    branch=live
+esac
+
+echo Branch: $1 is mapped to target: $target
+echo Remote server can be found at:
+echo 'http://'$target
+
+mkdir -p $local_base/$target
+cd $local_base/$target
+echo Updating local checkout...
+git checkout $branch
+git pull
+
+if [ 1$branch != 1live ]; then
+  echo Pushing files to $target...
+  rsync -az --exclude=.git/ --delete /home/git/local/checkouts/enc/$target/ vcshookuser@enc-dev0.fsf.org:/var/www/$branch/ #2>/dev/null
+  echo Fixing permissions on webserver...
+  ssh vcshookuser@enc-dev0.fsf.org 'find /var/www/ -type f -print0 | xargs -0 chmod 664 && find /var/www/ -type d -print0 | xargs -0 chmod 775' # 2>/dev/null
+fi
+exec git update-server-info