add untracked hook script to git
authorIan Kelling <iank@fsf.org>
Tue, 21 Nov 2017 19:42:05 +0000 (14:42 -0500)
committerIan Kelling <iank@fsf.org>
Tue, 21 Nov 2017 19:42:05 +0000 (14:42 -0500)
hooks/post-update [new file with mode: 0755]

diff --git a/hooks/post-update b/hooks/post-update
new file mode 100755 (executable)
index 0000000..b737c4b
--- /dev/null
@@ -0,0 +1,37 @@
+#!/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_checkout=/home/git/local/checkouts/fsf-giving-guide
+
+case $1 in
+    refs/heads/master)
+        ;;
+    *)
+        echo
+        echo "use the 'master' branch to update the gift giving site."
+        echo
+        exit 0
+        ;;
+esac
+
+unset GIT_DIR
+echo Deploying to fsf.org...
+
+cd $local_checkout
+echo Updating local checkout...
+git pull
+git reset --hard $1
+echo Copying files...
+# A lot of files that we *don't* want to copy, so we're selective.
+rsync -az --delete --prune-empty-dirs \
+    --include='*/' --include='givingguide.html' --include='js/*' \
+    --include='images/*' --include='fonts/*' --include='*.css' --exclude='*' \
+    /home/git/local/checkouts/fsf-giving-guide \
+    vcshookuser@fsf.org:/var/www/ #2>/dev/null
+echo Fixing permissions on webserver...
+ssh vcshookuser@fsf.org 'find /var/www/fsf-giving-guide -type f -print0 | xargs -0 chmod 664 && find /var/www/fsf-giving-guide -type d -print0 | xargs -0 chmod 775' # 2>/dev/null
+exec git update-server-info