# Copyright (C) 2012 # Charles Roussel # Simon Cathebras # Julien Khayat # Guillaume Sasdy # Simon Perrat # License: GPL v2 or later # # CONFIGURATION VARIABLES # You might want to change these ones # . ./test.config CURR_DIR=$(pwd) TEST_OUTPUT_DIRECTORY=$(pwd) TEST_DIRECTORY="$CURR_DIR"/../../../t export TEST_OUTPUT_DIRECTORY TEST_DIRECTORY CURR_DIR if test "$LIGHTTPD" = "false" ; then PORT=80 else WIKI_DIR_INST="$CURR_DIR/$WEB_WWW" fi # ================= Install part ================= error () { echo "$@" >&2 exit 1 } # config_lighttpd # # Create the configuration files and the folders necessary to start lighttpd. # Overwrite any existing file. config_lighttpd () { mkdir -p $WEB mkdir -p $WEB_TMP mkdir -p $WEB_WWW cat > $WEB/lighttpd.conf < "application/pdf", ".sig" => "application/pgp-signature", ".spl" => "application/futuresplash", ".class" => "application/octet-stream", ".ps" => "application/postscript", ".torrent" => "application/x-bittorrent", ".dvi" => "application/x-dvi", ".gz" => "application/x-gzip", ".pac" => "application/x-ns-proxy-autoconfig", ".swf" => "application/x-shockwave-flash", ".tar.gz" => "application/x-tgz", ".tgz" => "application/x-tgz", ".tar" => "application/x-tar", ".zip" => "application/zip", ".mp3" => "audio/mpeg", ".m3u" => "audio/x-mpegurl", ".wma" => "audio/x-ms-wma", ".wax" => "audio/x-ms-wax", ".ogg" => "application/ogg", ".wav" => "audio/x-wav", ".gif" => "image/gif", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".png" => "image/png", ".xbm" => "image/x-xbitmap", ".xpm" => "image/x-xpixmap", ".xwd" => "image/x-xwindowdump", ".css" => "text/css", ".html" => "text/html", ".htm" => "text/html", ".js" => "text/javascript", ".asc" => "text/plain", ".c" => "text/plain", ".cpp" => "text/plain", ".log" => "text/plain", ".conf" => "text/plain", ".text" => "text/plain", ".txt" => "text/plain", ".dtd" => "text/xml", ".xml" => "text/xml", ".mpeg" => "video/mpeg", ".mpg" => "video/mpeg", ".mov" => "video/quicktime", ".qt" => "video/quicktime", ".avi" => "video/x-msvideo", ".asf" => "video/x-ms-asf", ".asx" => "video/x-ms-asf", ".wmv" => "video/x-ms-wmv", ".bz2" => "application/x-bzip", ".tbz" => "application/x-bzip-compressed-tar", ".tar.bz2" => "application/x-bzip-compressed-tar", "" => "text/plain" ) fastcgi.server = ( ".php" => ("localhost" => ( "socket" => "$CURR_DIR/$WEB_TMP/php.socket", "bin-path" => "$PHP_DIR/php-cgi -c $CURR_DIR/$WEB/php.ini" ) ) ) EOF cat > $WEB/php.ini < "$file_swap" mv "$file_swap" "$FILES_FOLDER/LocalSettings-tmp.php" sed "s,@WG_SERVER@,http://$SERVER_ADDR," \ "$FILES_FOLDER/LocalSettings-tmp.php" > "$file_swap" mv "$file_swap" "$FILES_FOLDER/LocalSettings-tmp.php" sed "s,@WG_SQLITE_DATADIR@,$TMP," \ "$FILES_FOLDER/LocalSettings-tmp.php" > "$file_swap" mv "$file_swap" "$FILES_FOLDER/LocalSettings-tmp.php" sed "s,@WG_SQLITE_DATAFILE@,$( basename $DB_FILE .sqlite)," \ "$FILES_FOLDER/LocalSettings-tmp.php" > "$file_swap" mv "$file_swap" "$FILES_FOLDER/LocalSettings-tmp.php" mv "$FILES_FOLDER/LocalSettings-tmp.php" \ "$WIKI_DIR_INST/$WIKI_DIR_NAME/LocalSettings.php" || error "Unable to move $FILES_FOLDER/LocalSettings-tmp.php" \ "in $WIKI_DIR_INST/$WIKI_DIR_NAME" echo "File $FILES_FOLDER/LocalSettings.php is set in" \ " $WIKI_DIR_INST/$WIKI_DIR_NAME" echo "Your wiki has been installed. You can check it at http://$SERVER_ADDR/$WIKI_DIR_NAME" } # Reset the database of the wiki and the password of the admin # # Warning: This function must be called only in a subdirectory of t/ directory wiki_reset () { # Copy initial database of the wiki if [ ! -f "../$FILES_FOLDER/$DB_FILE" ] ; then error "Can't find ../$FILES_FOLDER/$DB_FILE in the current folder." fi cp "../$FILES_FOLDER/$DB_FILE" "$TMP" || error "Can't copy ../$FILES_FOLDER/$DB_FILE in $TMP" echo "File $FILES_FOLDER/$DB_FILE is set in $TMP" } # Delete the wiki created in the web server's directory and all its content # saved in the database. wiki_delete () { if test $LIGHTTPD = "true"; then stop_lighttpd else # Delete the wiki's directory. rm -rf "$WIKI_DIR_INST/$WIKI_DIR_NAME" || error "Wiki's directory $WIKI_DIR_INST/" \ "$WIKI_DIR_NAME could not be deleted" # Delete the wiki's SQLite database. rm -f "$TMP/$DB_FILE" || error "Database $TMP/$DB_FILE could not be deleted." fi # Delete the wiki's SQLite database rm -f "$TMP/$DB_FILE" || error "Database $TMP/$DB_FILE could not be deleted." rm -f "$FILES_FOLDER/$DB_FILE" rm -rf "$TMP/$MW_VERSION" }