#!/bin/sh DEBUG=false SCRIPT_NAME=`basename $0` LIVE_PATH="/home/hosted/pouet/sites/www.pouet.net" TEST_PATH="/home/hosted/pouet/sites/test.pouet.net" RSYNC="rsync --recursive \ --delete \ --progress \ --checksum \ --links\ --keep-dirlinks \ --exclude=avatars \ --exclude=gfx/logos \ --exclude=nfo \ --exclude=othernfo \ --exclude=results \ --exclude=screenshots \ --exclude=rulez/*.log \ --exclude=tmp/* \ --exclude=include/auth.php \ --exclude=.git" if $DEBUG then RSYNC="$RSYNC --dry-run" fi function usage() { echo "Usage: $SCRIPT_NAME " echo " - $SCRIPT_NAME push test : Push local version to test.pouet.net" echo " - $SCRIPT_NAME push live : Push local version to pouet.net" echo " - $SCRIPT_NAME pull test : Pull test.pouet.net locally" echo " - $SCRIPT_NAME pull live : Pull pouet.net locally" exit 1 } copy_cache_from_live_to_test() { ssh pouet cp $LIVE_PATH/tmp/* $TEST_PATH/tmp/ ssh pouet cp $LIVE_PATH/include/auth.php $TEST_PATH/include/auth.php } function push_test() { $RSYNC ./ pouet:$TEST_PATH copy_cache_from_live_to_test } function push_live() { $RSYNC ./ pouet:$LIVE_PATH } function pull_test() { $RSYNC pouet:$TEST_PATH/ . } function pull_live() { $RSYNC pouet:$LIVE_PATH/ . } if [ ! -f .git/index ] then echo "Error: launch $SCRIPT_NAME at the root of the source folder pls oh pls" exit 1 fi case "$1" in push) case "$2" in test) push_test ;; live) push_live ;; *) usage ;; esac ;; pull) case "$2" in test) pull_test ;; live) pull_live ;; *) usage ;; esac ;; *) usage;; esac