From f87851833240c8d8e2999bcb4b11c2c0edbf2206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= Date: Wed, 21 Mar 2012 09:07:59 +0100 Subject: [PATCH] =?UTF-8?q?Working=20on=20Ba=C3=AFkal=20Standalone=20Serve?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CoreVersions/Baikal_0.1/Bootstrap.php | 1 + .../builds/{linux => ubuntux64}/mongoose | Bin CoreVersions/Baikal_0.1/Mongoose/mongoose.sh | 29 --------- CoreVersions/Baikal_0.1/Mongoose/run.sh | 56 ++++++++++++++++++ Specific/config.php | 29 ++------- 5 files changed, 61 insertions(+), 54 deletions(-) rename CoreVersions/Baikal_0.1/Mongoose/builds/{linux => ubuntux64}/mongoose (100%) delete mode 100755 CoreVersions/Baikal_0.1/Mongoose/mongoose.sh create mode 100755 CoreVersions/Baikal_0.1/Mongoose/run.sh diff --git a/CoreVersions/Baikal_0.1/Bootstrap.php b/CoreVersions/Baikal_0.1/Bootstrap.php index 74c1e89..15f0296 100644 --- a/CoreVersions/Baikal_0.1/Bootstrap.php +++ b/CoreVersions/Baikal_0.1/Bootstrap.php @@ -62,6 +62,7 @@ define("BAIKAL_PATH_FRAMEWORKS", BAIKAL_PATH_CORE . "Frameworks/"); define("BAIKAL_PATH_WWWROOT", BAIKAL_PATH_CORE . "WWWRoot/"); require_once(BAIKAL_PATH_SPECIFIC . "config.php"); +require_once(BAIKAL_PATH_SPECIFIC . "config.system.php"); date_default_timezone_set(BAIKAL_TIMEZONE); diff --git a/CoreVersions/Baikal_0.1/Mongoose/builds/linux/mongoose b/CoreVersions/Baikal_0.1/Mongoose/builds/ubuntux64/mongoose similarity index 100% rename from CoreVersions/Baikal_0.1/Mongoose/builds/linux/mongoose rename to CoreVersions/Baikal_0.1/Mongoose/builds/ubuntux64/mongoose diff --git a/CoreVersions/Baikal_0.1/Mongoose/mongoose.sh b/CoreVersions/Baikal_0.1/Mongoose/mongoose.sh deleted file mode 100755 index 181c743..0000000 --- a/CoreVersions/Baikal_0.1/Mongoose/mongoose.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -platform='unknown' -unamestr=`uname` -if [[ "$unamestr" == 'Linux' ]]; then - platform='linux' -elif [[ "$unamestr" == 'FreeBSD' ]]; then - platform='freebsd' -elif [[ "$unamestr" == 'Darwin' ]]; then - platform='osx' -fi - -PATH_docroot=`cd ../../../html && pwd` -echo "Serving $PATH_docroot" - -PATH_this="`pwd`/" -MONGOOSE_builds=$PATH_this"builds/" -MONGOOSE_cgi=$PATH_this"cgi/" - -if [[ $platform == 'linux' ]]; then - MONGOOSE_bin=$MONGOOSE_builds"linux/mongoose" - MONGOOSE_cgibin=$MONGOOSE_cgi"ubuntux64/php-cgi" -elif [[ $platform == 'freebsd' ]]; then - echo "FreeBSD !" -elif [[ $platform == 'osx' ]]; then - MONGOOSE_bin=$MONGOOSE_builds"mac/mongoose" - MONGOOSE_cgibin=$MONGOOSE_cgi"mac/php-cgi" -fi - -`$MONGOOSE_bin -I $MONGOOSE_cgibin -i index.html,index.php -r $PATH_docroot` diff --git a/CoreVersions/Baikal_0.1/Mongoose/run.sh b/CoreVersions/Baikal_0.1/Mongoose/run.sh new file mode 100755 index 0000000..f820de6 --- /dev/null +++ b/CoreVersions/Baikal_0.1/Mongoose/run.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +PATH_scriptfile=`readlink -f $0` +PATH_scriptdir=`dirname $PATH_scriptfile`"/" +PATH_root=`dirname $(dirname $(dirname $PATH_scriptdir))`"/" +PATH_docroot=$PATH_root"html/" + +PATH_specific=$PATH_root"Specific/" +PATH_configfile=$PATH_specific"config.php" + +MONGOOSE_builds=$PATH_scriptdir"builds/" +MONGOOSE_cgi=$PATH_scriptdir"cgi/" + +function whichPlatform() { + local platform='unknown' + local unamestr=`uname` + + if [[ "$unamestr" == 'Linux' ]]; then + platform='linux' + elif [[ "$unamestr" == 'FreeBSD' ]]; then + platform='freebsd' + elif [[ "$unamestr" == 'Darwin' ]]; then + platform='osx' + fi + + echo "$platform" +} + +function getBaikalConf() { + local conf=$(php -r "require_once('$PATH_configfile'); if(is_bool($1)) { echo intval($1);} else { echo $1;}") + echo $conf +} + +BAIKAL_standaloneenabled=$(getBaikalConf BAIKAL_STANDALONE_ENABLED) +if [[ "$BAIKAL_standaloneenabled" == '0' ]]; then + echo "Baïkal Standalone Server is disabled by config." + exit 0 +fi + +BAIKAL_standaloneport=$(getBaikalConf BAIKAL_STANDALONE_PORT) +BAIKAL_baseuri=$(getBaikalConf BAIKAL_BASEURI) + +platform=$(whichPlatform) +echo "Serving standalone Baïkal at $BAIKAL_baseuri:$BAIKAL_standaloneport ('$PATH_docroot' on $platform )" + +if [[ $platform == 'linux' ]]; then + MONGOOSE_bin=$MONGOOSE_builds"ubuntux64/mongoose" + MONGOOSE_cgibin=$MONGOOSE_cgi"ubuntux64/php-cgi" +elif [[ $platform == 'freebsd' ]]; then + echo "FreeBSD !" +elif [[ $platform == 'osx' ]]; then + MONGOOSE_bin=$MONGOOSE_builds"mac/mongoose" + MONGOOSE_cgibin=$MONGOOSE_cgi"mac/php-cgi" +fi + +`$MONGOOSE_bin -p $BAIKAL_standaloneport -I $MONGOOSE_cgibin -i index.html,index.php -r $PATH_docroot` diff --git a/Specific/config.php b/Specific/config.php index 5fef1a0..69822b0 100755 --- a/Specific/config.php +++ b/Specific/config.php @@ -14,7 +14,6 @@ define("BAIKAL_BASEURI", "http://dav.mydomain.com/"); # WEB absolute URI define("BAIKAL_ADMIN_ENABLED", TRUE); - ############################################################################## # In this section: Optional configuration: you *may* customize these settings # @@ -25,28 +24,8 @@ define("BAIKAL_CARD_ENABLED", TRUE); # CalDAV ON/OFF switch define("BAIKAL_CAL_ENABLED", TRUE); +# CalDAV ON/OFF switch +define("BAIKAL_STANDALONE_ENABLED", FALSE); -############################################################################## -############################################################################## -############################################################################## -# System configuration -# Should not be changed, unless YNWYD -# -# RULES -# 0. All folder pathes *must* be suffixed by "/" -# - -# PATH to SabreDAV -define("BAIKAL_PATH_SABREDAV", BAIKAL_PATH_FRAMEWORKS . "SabreDAV/lib/Sabre/"); - -# If you change this value, you'll have to re-generate passwords for all your users -define("BAIKAL_AUTH_REALM", "BaikalDAV"); - -# Should begin with a "/" -define("BAIKAL_CARD_BASEURI", "/card.php/"); - -# Should begin with a "/" -define("BAIKAL_CAL_BASEURI", "/cal.php/"); - -# SQLite DB path -define("BAIKAL_SQLITE_FILE", BAIKAL_PATH_SPECIFIC . "db/baikal.sqlite"); +# CalDAV ON/OFF switch +define("BAIKAL_STANDALONE_PORT", 8888); \ No newline at end of file