From 92541b22680a9877877be60e9639c2d919c83c47 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 21 Nov 2017 14:42:05 -0500 Subject: [PATCH] add untracked hook script to git --- hooks/post-update | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 hooks/post-update diff --git a/hooks/post-update b/hooks/post-update new file mode 100755 index 0000000..b737c4b --- /dev/null +++ b/hooks/post-update @@ -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 -- 2.25.1