mirror of
https://github.com/psenough/pouet.net.git
synced 2025-01-17 21:28:32 +01:00
3e3a18afb2
Also don't show any error when tmp is empty, as it should be emptiable whenever we want.
90 lines
2.0 KiB
Bash
Executable File
90 lines
2.0 KiB
Bash
Executable File
#!/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=include/*.inc \
|
|
--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 <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"
|
|
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/ .
|
|
}
|
|
|
|
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
|