clarify git hooks folder
[fsf-giving-guide.git] / git-hooks / post-update
1 #!/bin/bash
2 #
3 # An example hook script to prepare a packed repository for use over
4 # dumb transports.
5 #
6 # To enable this hook, rename this file to "post-update".
7
8 local_checkout=/home/git/local/checkouts/fsf-giving-guide
9
10 case $1 in
11     refs/heads/master)
12         ;;
13     *)
14         echo
15         echo "use the 'master' branch to update the gift giving site."
16         echo
17         exit 0
18         ;;
19 esac
20
21 unset GIT_DIR
22 echo Deploying to fsf.org...
23
24 cd $local_checkout
25 echo Updating local checkout...
26 git pull
27 git reset --hard $1
28 echo Copying files...
29 # A lot of files that we *don't* want to copy, so we're selective.
30 rsync -az --delete --prune-empty-dirs \
31     --include='*/' --include='givingguide.html' --include='js/*' \
32     --include='images/*' --include='fonts/*' --include='*.css' --exclude='*' \
33     /home/git/local/checkouts/fsf-giving-guide \
34     vcshookuser@fsf.org:/var/www/ #2>/dev/null
35 echo Fixing permissions on webserver...
36 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
37 exec git update-server-info