From 7d3f6baabf9327e52dec2bad383489970e8ad288 Mon Sep 17 00:00:00 2001 From: Lisa Marie Maginnis Date: Tue, 5 Jul 2016 13:35:00 -0400 Subject: [PATCH] fixed ryf --- ryf.git/post-update | 48 +++++++++++++++++++++++++++++-- ryf.git/post-update.ryf.fsf.org | 51 --------------------------------- 2 files changed, 46 insertions(+), 53 deletions(-) delete mode 100755 ryf.git/post-update.ryf.fsf.org diff --git a/ryf.git/post-update b/ryf.git/post-update index 06f8b8f..91bcf5a 100755 --- a/ryf.git/post-update +++ b/ryf.git/post-update @@ -2,5 +2,49 @@ # # An example hook script that is called after a successful # push is made. -# -exec ./post-update.ryf.fsf.org +echo "------- post-update started -------" +# Disabling this, we're moving to rsync because it works better. +#ssh www-data@ryf.fsf.org "cd /var/www/git;git pull" +unset GIT_DIR +SELF=ryf.git +REPO_DIR=$HOME/repositories +CHECKOUT_DIR=$HOME/local/checkouts/$SELF +TARGET_DIR=/var/www +TARGET_HOST=ryf.fsf.org + + +case $1 in + refs/heads/live) + branch=live + TARGET_DIR=$TARGET_DIR/ryf.fsf.org + ;; + refs/heads/dev) + branch=dev + TARGET_DIR=$TARGET_DIR/ryf-dev.fsf.org + ;; +*) + echo "No action for this branch!" + ;; +esac + + +echo "Updating local checkout..." +if [ ! -d $CHECKOUT_DIR ]; then + git clone $REPO_DIR/$SELF $CHECKOUT_DIR + cd $CHECKOUT_DIR + git checkout $branch +else + cd $CHECKOUT_DIR + git checkout $branch + git pull origin $branch +fi + +if [ -n $TARGET_HOST ]; then + echo Deploying to: $TARGET_DIR + rsync -avrSPX --delete-after $CHECKOUT_DIR/* root@$TARGET_HOST:$TARGET_DIR/ +fi +echo "------- post-update finished ------" +exec git update-server-info + + + diff --git a/ryf.git/post-update.ryf.fsf.org b/ryf.git/post-update.ryf.fsf.org deleted file mode 100755 index 338f315..0000000 --- a/ryf.git/post-update.ryf.fsf.org +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# -# An example hook script that is called after a successful -# push is made. -# - -echo "------- post-update started -------" -# Disabling this, we're moving to rsync because it works better. -#ssh www-data@ryf.fsf.org "cd /var/www/git;git pull" -unset GIT_DIR -SELF=ryf.git -REPO_DIR=$HOME/repositories -CHECKOUT_DIR=$HOME/local/checkouts/$SELF -TARGET_DIR=/var/www -TARGET_HOST=ryf.fsf.org - - -case $1 in - refs/heads/live) - branch=live - TARGET_DIR=$TARGET_DIR/ryf.fsf.org - ;; - refs/heads/dev) - branch=dev - TARGET_DIR=$TARGET_DIR/ryf-dev.fsf.org - ;; -*) - echo "No action for this branch!" - ;; -esac - - -echo "Updating local checkout..." -if [ ! -d $CHECKOUT_DIR ]; then - git clone $REPO_DIR/$SELF $CHECKOUT_DIR - cd $CHECKOUT_DIR - git checkout $branch -else - cd $CHECKOUT_DIR - git checkout $branch - git pull origin $branch -fi - -if [ -n $TARGET_HOST ]; then - echo Deploying to: $TARGET_DIR - rsync -avrSPX --delete-after $CHECKOUT_DIR/* root@$TARGET_HOST:$TARGET_DIR/ -fi - -exec git update-server-info -echo "------- post-update finished ------" - -- 2.25.1