3 date_fmt
="+%m-%d-%Y %H:%M:%S"
5 local_checkout_base
=/home
/git
/local
/checkouts
/edward
6 package_path_base
=/var
/www
/agpl.fsf.org
/emailselfdefense.fsf.org
/edward
/
7 package_host
=agpl.fsf.org
9 package_user
=vcshookuser
11 repository
=/home
/git
/repositories
/edward.git
13 target_path
=~
$remote_user/edward-src
15 doc_base
=/var
/www
/docs
/$package_name
17 echo -n $
(date "$date_fmt"); echo " - Starting post-update hook..."
19 # Unset GIT_DIR to allow for calls to git clone/pull
20 git update-server-info
24 # Extract the branch name
25 branch
=$
(echo $1 |
awk -F'/' '{print $3}')
28 echo -n $
(date "$date_fmt"); echo " - Processing branch: $1"
30 # Set branch specific configurations
33 local_checkout
=$local_checkout_base/$branch
34 package_path
=$package_path_base/
35 target_host
=fencepost.gnu.org
38 echo Hook
for $branch does not exist
, taking no further action.
43 doc_path
=$doc_base/$branch
45 echo -n $
(date "$date_fmt"); echo " - Target host: $target_host"
46 echo -n $
(date "$date_fmt"); echo " - Target path: $target_path"
47 echo -n $
(date "$date_fmt"); echo " - Package host: $package_host"
48 echo -n $
(date "$date_fmt"); echo " - Package path: $package_path"
49 echo -n $
(date "$date_fmt"); echo " - Remote user: $remote_user"
51 # See if local checkout exists
52 if [ ! -d $local_checkout ]; then
53 echo -n $
(date "$date_fmt"); echo " - No local checkout detected, creating now"
54 mkdir
-p $local_checkout
55 git clone
$repository $local_checkout &>/dev
/null
57 git checkout
$branch &>/dev
/null
59 echo -n $
(date "$date_fmt"); echo " - Updating local checkout"
61 git checkout
$branch &>/dev
/null
62 git pull origin
$branch &>/dev
/null
65 echo -n $
(date "$date_fmt"); echo " - Packing zip and tarball for package host"
66 rm -f $local_checkout_base/*tar.gz
67 rm -f $local_checkout_base/*zip
68 cd $local_checkout_base
69 tar czv
--exclude-vcs -f $package_name.
tar.gz
$branch &>/dev
/null
70 zip -r $package_name $branch -x "*/.git/*" "*/.gitignore" &>/dev
/null
72 echo -n $
(date "$date_fmt"); echo " - Pushing to packaging server: https://$package_host/emailselfdefense.fsf.org/edward/"
73 scp
$package_name.
zip $package_name.
tar.gz
$package_user@
$package_host:$package_path/ >/dev
/null
75 # Stop here if not updating a host
76 if [ -z $target_host ]; then
80 echo -n $
(date "$date_fmt"); echo " - Pushing files to target host: $target_host:$target_path"
81 rsync
-arvPSX --exclude=lang
/ --exclude=.git
/ --delete $local_checkout/* $remote_user@
$target_host:$target_path/ &>/dev
/null