2013-05-04 17:53:44 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-05-04 19:19:14 -04:00
|
|
|
DEBUG=false
|
2013-05-04 19:21:38 -04:00
|
|
|
SCRIPT_NAME=`basename $0`
|
2013-05-04 19:19:14 -04:00
|
|
|
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\
|
|
|
|
--exclude=include/*.inc \
|
|
|
|
--exclude=rulez/*.log \
|
2013-05-07 14:14:39 -04:00
|
|
|
--exclude=cache/*
|
2013-05-04 19:19:14 -04:00
|
|
|
--exclude=include/auth.php \
|
2013-05-04 23:02:26 -04:00
|
|
|
--exclude=LAST_SCENEORG_CHECK \
|
2013-05-04 19:26:38 -04:00
|
|
|
--exclude=.git"
|
2013-05-04 19:19:14 -04:00
|
|
|
|
|
|
|
if $DEBUG
|
|
|
|
then
|
|
|
|
RSYNC="$RSYNC --dry-run"
|
|
|
|
fi
|
|
|
|
|
2013-05-04 17:53:44 -04:00
|
|
|
function usage()
|
|
|
|
{
|
2013-05-04 19:21:38 -04:00
|
|
|
echo "Usage: $SCRIPT_NAME <push|pull> <test|live>"
|
|
|
|
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"
|
2013-05-04 19:19:14 -04:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
copy_cache_from_live_to_test()
|
|
|
|
{
|
|
|
|
ssh pouet cp $LIVE_PATH/include/*.inc $TEST_PATH/include/
|
|
|
|
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/ .
|
2013-05-04 17:53:44 -04:00
|
|
|
}
|
|
|
|
|
2013-05-04 19:19:14 -04:00
|
|
|
function pull_live()
|
|
|
|
{
|
|
|
|
$RSYNC pouet:$LIVE_PATH/ .
|
|
|
|
}
|
|
|
|
|
2013-05-04 19:21:38 -04:00
|
|
|
if [ ! -f .git/index ]
|
2013-05-04 19:19:14 -04:00
|
|
|
then
|
2013-05-04 19:21:38 -04:00
|
|
|
echo "Error: launch $SCRIPT_NAME at the root of the source folder pls oh pls"
|
2013-05-04 19:19:14 -04:00
|
|
|
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
|