#!/bin/true # REMOTE SCRIPT (can not interact with user) # turn on debug mode (use 'set +x' to disable it) # set -x # {{VAR_NAME}} - template variables ERR_CODE_EXEC_ERROR="{{ERR_CODE_EXEC_ERROR}}" ERR_CODE_USER_FILES_EXISTS="{{ERR_CODE_USER_FILES_EXISTS}}" REMOTE_SITE_DIR="{{REMOTE_SITE_DIR}}" REMOTE_WWW_DIR="{{REMOTE_WWW_DIR}}" SVN_BIND_PORT="{{SVN_BIND_PORT}}" REMOTE_FORCE_UNPACK="{{REMOTE_FORCE_UNPACK}}" #if test $(uname -n) = "CatZilla"; then # echo "> ERROR: remote script should not be executed on CatZilla" 1>&2 # exit 1 #fi CURRENT_DIR=$(pwd) SITE_PARENT_DIR=$(dirname ${REMOTE_SITE_DIR}) SITE_DIR_NAME=$(basename ${REMOTE_SITE_DIR}) WWW_PARENT_DIR=$(dirname ${REMOTE_WWW_DIR}) WWW_DIR_NAME=$(basename ${REMOTE_WWW_DIR}) cd ${REMOTE_WWW_DIR} || exit ${ERR_CODE_EXEC_ERROR} USER_FILES_ARCHIVE="$REMOTE_WWW_DIR/uf.tar.bz2" USER_FILES_DIR="$REMOTE_WWW_DIR/userfiles" if [ -d "$USER_FILES_DIR" ] ; then if [ "$REMOTE_FORCE_UNPACK" != "y" ] ; then exit $ERR_CODE_USER_FILES_EXISTS; fi else mkdir "$USER_FILES_DIR" echo "created userfiles directory" fi tar -xjf $USER_FILES_ARCHIVE -C $USER_FILES_DIR rm $USER_FILES_ARCHIVE; exit 0