#!/bin/bash . _config.sh case $1 in '--help') echo 'Version: setup.sh QSF 2.1 2010-05-26' echo 'Usage: ./setup.sh [options ...]' echo echo ' --cleanBom Clean BOM marker in .php, .ini, .html and .js files' echo ' --pack Pack .css and .js files with YUI Compressor' echo ' --exportPack Export packed .css and .js files to tar.bz2 archive' echo ' --removePack Remove *.pack.js, *.pack.css files' echo ' --removeThumbnails Remove Thumbnails' echo ' --addClassesWrappers Add wrappers for Qs classes' echo ' --commitFiles Archive and commit "www/userfiles" folder' echo ' --help This page' echo exit;; '--pack' ) shift ./pack.sh $@ exit;; '--cleanBom' ) shift ./cleanBom.sh $@ exit;; '--exportPack' ) shift ./exportPack.sh $@ exit;; '--removePack' ) shift ./removePack.sh $@ exit;; '--removeThumbnails' ) shift ./removeThumbnails.sh $@ exit;; '--addClassesWrappers' ) shift ./addClassesWrappers.sh $@ exit;; '--commitFiles' ) shift ./files_ci.sh $@ exit;; esac # userfiles if [ -L "$BASE_PATH/www/$FILES_DIRECTORY" ] ; then unlink $BASE_PATH/www/$FILES_DIRECTORY fi archiveName="`echo $FILES_DIRECTORY | sed 's/\W+/_/'`.tar.bz2" if [ ! -d "$PUB_BASE_PATH/www/$FILES_DIRECTORY" ] ; then mkdir -p $PUB_BASE_PATH/www/$FILES_DIRECTORY mkdir -p $PUB_BASE_PATH/www/$FILES_DIRECTORY/fck mkdir -p $PUB_BASE_PATH/www/$FILES_DIRECTORY/fckthumbs mkdir -p $PUB_BASE_PATH/www/$FILES_DIRECTORY/files mkdir -p $PUB_BASE_PATH/www/$FILES_DIRECTORY/parts-pdf chmod -R 777 $PUB_BASE_PATH/www/$FILES_DIRECTORY 2>/dev/null CURRENT_DIR=`pwd` cd $PUB_BASE_PATH/www/$FILES_DIRECTORY/ ln -s files images cd $CURRENT_DIR echo 'Options -Indexes' > $PUB_BASE_PATH/www/$FILES_DIRECTORY/.htaccess $SVN export $REPOSITORY_URL/$PROJECT_NAME/$FILES_BACKUP_DIR/$BRANCHE_PATH/$archiveName $PUB_BASE_PATH/www/$FILES_DIRECTORY/$archiveName 2>/dev/null if [ -f "$PUB_BASE_PATH/www/$FILES_DIRECTORY/$archiveName" ] ; then cd $PUB_BASE_PATH/www/$FILES_DIRECTORY/ $TAR -xjf $archiveName rm -f $archiveName cd $CURRENT_DIR else echo 'WARNING: Can not export project files' fi fi ln -s $PUB_BASE_PATH/www/$FILES_DIRECTORY $BASE_PATH/www/$FILES_DIRECTORY # end userfiles if [ -L "$BASE_PATH/site/tmp/cache" ] ; then unlink $BASE_PATH/site/tmp/cache fi if [ -d "$BASE_PATH/site/tmp/cache" ] ; then rm -Rf $BASE_PATH/site/tmp/cache fi if [ ! -d "$PUB_BASE_PATH/site/tmp/cache" ] ; then mkdir -p $PUB_BASE_PATH/site/tmp/cache chmod 777 $PUB_BASE_PATH/site/tmp/cache 2>/dev/null fi ln -s $PUB_BASE_PATH/site/tmp/cache $BASE_PATH/site/tmp/cache chmod -R 777 $PUB_BASE_PATH/site/tmp 2>/dev/null rm -Rf $PUB_BASE_PATH/site/tmp/cache/* rm -Rf $BASE_PATH/site/tmp/tpl_c/*.php 2>/dev/null chmod -R 777 $BASE_PATH/www/images/captcha 2>/dev/null find $BASE_PATH/www/js -name '*.merge.js' -type f -exec rm '{}' \; find $BASE_PATH/www/css -name '*.merge.css' -type f -exec rm '{}' \;