updated ryf hook
[deploy-hooks.git] / ryf.git / post-update.ryf.fsf.org
CommitLineData
c3733902
LMM
1#!/bin/sh
2#
3# An example hook script that is called after a successful
4# push is made.
5#
6
7echo "------- post-update started -------"
1b6e760d
LMM
8# Disabling this, we're moving to rsync because it works better.
9#ssh www-data@ryf.fsf.org "cd /var/www/git;git pull"
10unset GIT_DIR
11SELF=ryf.git
12REPO_DIR=$HOME/repositories
13CHECKOUT_DIR=$HOME/local/checkouts/$SELF
14TARGET_DIR=/var/www/ryf.fsf.org
15TARGET_HOST=ryf.fsf.org
16
17
18case $1 in
19 refs/heads/live)
20 branch=live
21 ;;
22 refs/heads/dev)
23 branch=dev
24 ;;
25*)
26 echo "No action for this branch!"
27 ;;
28esac
29
30
31echo "Updating local checkout..."
32if [ ! -d $CHECKOUT_DIR ]; then
33 git clone $REPO_DIR/$SELF $CHECKOUT_DIR
34 cd $CHECKOUT_DIR
35 git checkout $branch
36else
37 cd $CHECKOUT_DIR
38 git checkout $branch
39 git pull origin $branch
40fi
41
42if [ -n $TARGET_HOST ]; then
43 echo Deploying to: $branch
44 rsync -avrSPX --delete-after $CHECKOUT_DIR/* root@$TARGET_HOST:$TARGET_DIR/
45fi
46
47exec git update-server-info
c3733902
LMM
48echo "------- post-update finished ------"
49