CC-1024 Update installation/build for webapp-only
Moved more installation stuff into PHP. For some reason it's having trouble creating the cc_playlistcontents table. Removed old installer files that are no longer used.
This commit is contained in:
parent
2eea85d502
commit
739801d180
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
define('ACCESS_TYPE', 'restore');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package Campcaster
|
* @package Campcaster
|
||||||
|
@ -49,6 +48,8 @@ class Restore {
|
||||||
*/
|
*/
|
||||||
private $gb;
|
private $gb;
|
||||||
|
|
||||||
|
private $ACCESS_TYPE = 'restore';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param GreenBox $gb
|
* @param GreenBox $gb
|
||||||
* greenbox object reference
|
* greenbox object reference
|
||||||
|
@ -58,7 +59,7 @@ class Restore {
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$this->gb =& $gb;
|
$this->gb =& $gb;
|
||||||
$this->token = null;
|
$this->token = null;
|
||||||
$this->logFile = $CC_CONFIG['bufferDir'].'/'.ACCESS_TYPE.'.log';
|
$this->logFile = $CC_CONFIG['bufferDir'].'/'.$this->ACCESS_TYPE.'.log';
|
||||||
if ($this->loglevel == 'debug') {
|
if ($this->loglevel == 'debug') {
|
||||||
$this->addLogItem("-I- ".date("Ymd-H:i:s")." construct\n");
|
$this->addLogItem("-I- ".date("Ymd-H:i:s")." construct\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -504,7 +504,8 @@ class StoredFile {
|
||||||
|
|
||||||
$storedFile->name = isset($p_values['filename']) ? $p_values['filename'] : $p_values["filepath"];
|
$storedFile->name = isset($p_values['filename']) ? $p_values['filename'] : $p_values["filepath"];
|
||||||
// NOTE: POSTGRES-SPECIFIC KEYWORD "DEFAULT" BEING USED, WOULD BE "NULL" IN MYSQL
|
// NOTE: POSTGRES-SPECIFIC KEYWORD "DEFAULT" BEING USED, WOULD BE "NULL" IN MYSQL
|
||||||
$storedFile->id = isset($p_values['id']) && is_integer($p_values['id'])?"'".$p_values['id']."'":'DEFAULT';
|
$storedFile->id = isset($p_values['id']) && is_integer($p_values['id'])?(int)$p_values['id']:null;
|
||||||
|
$sqlId = !is_null($storedFile->id)?"'".$storedFile->id."'":'DEFAULT';
|
||||||
$storedFile->ftype = isset($p_values['filetype']) ? strtolower($p_values['filetype']) : "audioclip";
|
$storedFile->ftype = isset($p_values['filetype']) ? strtolower($p_values['filetype']) : "audioclip";
|
||||||
$storedFile->mime = (isset($p_values["mime"]) ? $p_values["mime"] : NULL );
|
$storedFile->mime = (isset($p_values["mime"]) ? $p_values["mime"] : NULL );
|
||||||
// $storedFile->filepath = $p_values['filepath'];
|
// $storedFile->filepath = $p_values['filepath'];
|
||||||
|
@ -529,7 +530,7 @@ class StoredFile {
|
||||||
$CC_DBC->query("BEGIN");
|
$CC_DBC->query("BEGIN");
|
||||||
$sql = "INSERT INTO ".$CC_CONFIG['filesTable']
|
$sql = "INSERT INTO ".$CC_CONFIG['filesTable']
|
||||||
."(id, name, gunid, mime, state, ftype, mtime, md5)"
|
."(id, name, gunid, mime, state, ftype, mtime, md5)"
|
||||||
."VALUES ({$storedFile->id}, '{$escapedName}', "
|
."VALUES ({$sqlId}, '{$escapedName}', "
|
||||||
." x'{$storedFile->gunid}'::bigint,"
|
." x'{$storedFile->gunid}'::bigint,"
|
||||||
." '{$storedFile->mime}', 'incomplete', '$escapedFtype',"
|
." '{$storedFile->mime}', 'incomplete', '$escapedFtype',"
|
||||||
." now(), '{$storedFile->md5}')";
|
." now(), '{$storedFile->md5}')";
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?php
|
|
||||||
define('CAMPCASTER_VERSION', '1.6.0-alpha');
|
|
||||||
define('CAMPCASTER_COPYRIGHT_DATE', '2010');
|
|
||||||
?>
|
|
199
conf.php
199
conf.php
|
@ -1,83 +1,93 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
define('CAMPCASTER_VERSION', '1.6.0-alpha');
|
||||||
* StorageServer configuration file
|
define('CAMPCASTER_COPYRIGHT_DATE', '2010');
|
||||||
*
|
|
||||||
* configuration structure:
|
|
||||||
*
|
|
||||||
* <dl>
|
|
||||||
* <dt>dsn<dd> datasource setting
|
|
||||||
* <dt>tblNamePrefix <dd>prefix for table names in the database
|
|
||||||
* <dt>authCookieName <dd>secret token cookie name
|
|
||||||
* <dt>AdminsGr <dd>name of admin group
|
|
||||||
* <dt>StationPrefsGr <dd>name of station preferences group
|
|
||||||
* <dt>AllGr <dd>name of 'all users' group
|
|
||||||
* <dt>storageDir <dd>main directory for storing binary media files
|
|
||||||
* <dt>bufferDir <dd>directory for temporary files
|
|
||||||
* <dt>transDir <dd>directory for incomplete transferred files
|
|
||||||
* <dt>accessDir <dd>directory for symlinks to accessed files
|
|
||||||
* <dt>validate <dd>enable/disable validator
|
|
||||||
* <dt>useTrash <dd>enable/disable safe delete (move to trash)
|
|
||||||
* <dt>storageUrlPath<dd>path-URL-part of storageServer base dir
|
|
||||||
* <dt>storageXMLRPC<dd>XMLRPC server script address relative to storageUrlPath
|
|
||||||
* <dt>storageUrlHost, storageUrlPort<dd>host and port of storageServer
|
|
||||||
* <dt>archiveUrlPath<dd>path-URL-part of archiveServer base dir
|
|
||||||
* <dt>archiveXMLRPC<dd>XMLRPC server script address relative to archiveUrlPath
|
|
||||||
* <dt>archiveUrlHost, archiveUrlPort<dd>host and port of archiveServer
|
|
||||||
* <dt>archiveAccountLogin, archiveAccountPass <dd>account info
|
|
||||||
* for login to archive
|
|
||||||
* <dt>sysSubjs<dd>system users/groups - cannot be deleted
|
|
||||||
* </dl>
|
|
||||||
*/
|
|
||||||
|
|
||||||
include("campcaster_version.php");
|
// These are the default values for the config.
|
||||||
|
|
||||||
// these are the default values for the config
|
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
// Note that these values can be overridden by the user config file,
|
||||||
|
// located in ~/.campcaster/storageServer.conf.php
|
||||||
|
// To disable this, set this variable to false.
|
||||||
|
define('ALLOW_CONF_OVERRIDE', false);
|
||||||
|
|
||||||
$CC_CONFIG = array(
|
$CC_CONFIG = array(
|
||||||
/* ================================================== basic configuration */
|
// Database config
|
||||||
'dsn' => array(
|
'dsn' => array(
|
||||||
'username' => 'test',
|
'username' => 'test2',
|
||||||
'password' => 'test',
|
'password' => 'test',
|
||||||
'hostspec' => 'localhost',
|
'hostspec' => 'localhost',
|
||||||
'phptype' => 'pgsql',
|
'phptype' => 'pgsql',
|
||||||
'database' => 'campcaster',
|
'database' => 'campcaster2',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Name of the web server user
|
||||||
'webServerUser' => 'www-data',
|
'webServerUser' => 'www-data',
|
||||||
|
|
||||||
|
// prefix for table names in the database
|
||||||
|
'tblNamePrefix' => 'cc_',
|
||||||
|
|
||||||
|
// main directory for storing binary media files
|
||||||
|
'storageDir' => dirname(__FILE__).'/stor',
|
||||||
|
|
||||||
|
// directory for temporary files
|
||||||
|
'bufferDir' => dirname(__FILE__).'/stor/buffer',
|
||||||
|
|
||||||
|
// directory for incomplete transferred files
|
||||||
|
'transDir' => dirname(__FILE__).'/trans',
|
||||||
|
|
||||||
|
// directory for symlinks to accessed files
|
||||||
|
'accessDir' => dirname(__FILE__).'/access',
|
||||||
|
'cronDir' => dirname(__FILE__).'/backend/cron',
|
||||||
|
|
||||||
|
/* ================================================ storage configuration */
|
||||||
"rootDir" => dirname(__FILE__),
|
"rootDir" => dirname(__FILE__),
|
||||||
"smartyTemplate" => dirname(__FILE__)."/htmlUI/templates",
|
"smartyTemplate" => dirname(__FILE__)."/htmlUI/templates",
|
||||||
"smartyTemplateCompiled" => dirname(__FILE__)."/htmlUI/templates_c",
|
"smartyTemplateCompiled" => dirname(__FILE__)."/htmlUI/templates_c",
|
||||||
|
'pearPath' => dirname(__FILE__).'/3rd_party/php/pear',
|
||||||
|
|
||||||
'tblNamePrefix' => 'cc_',
|
// secret token cookie name
|
||||||
/* ================================================ storage configuration */
|
|
||||||
'authCookieName'=> 'campcaster_session_id',
|
'authCookieName'=> 'campcaster_session_id',
|
||||||
|
|
||||||
|
// name of admin group
|
||||||
//'AdminsGr' => 'Admins',
|
//'AdminsGr' => 'Admins',
|
||||||
|
|
||||||
|
// name of station preferences group
|
||||||
'StationPrefsGr'=> 'StationPrefs',
|
'StationPrefsGr'=> 'StationPrefs',
|
||||||
|
|
||||||
|
// name of 'all users' group
|
||||||
//'AllGr' => 'All',
|
//'AllGr' => 'All',
|
||||||
'TrashName' => 'trash_',
|
'TrashName' => 'trash_',
|
||||||
'storageDir' => dirname(__FILE__).'/stor',
|
|
||||||
'bufferDir' => dirname(__FILE__).'/stor/buffer',
|
// enable/disable validator
|
||||||
'transDir' => dirname(__FILE__).'/trans',
|
|
||||||
'accessDir' => dirname(__FILE__).'/access',
|
|
||||||
'pearPath' => dirname(__FILE__).'/3rd_party/php/pear',
|
|
||||||
// 'zendPath' => dirname(__FILE__).'/../../../../usr/lib',
|
|
||||||
'cronDir' => dirname(__FILE__).'/backend/cron',
|
|
||||||
'validate' => TRUE,
|
'validate' => TRUE,
|
||||||
|
|
||||||
|
// enable/disable safe delete (move to trash)
|
||||||
'useTrash' => TRUE,
|
'useTrash' => TRUE,
|
||||||
|
|
||||||
/* ==================================================== URL configuration */
|
/* ==================================================== URL configuration */
|
||||||
'storageUrlPath' => '/campcaster/backend',
|
// path-URL-part of storageServer base dir
|
||||||
'storageXMLRPC' => 'xmlrpc/xrLocStor.php',
|
'storageUrlPath' => '/campcaster/backend',
|
||||||
'storageUrlHost' => 'localhost',
|
|
||||||
|
// XMLRPC server script address relative to storageUrlPath
|
||||||
|
'storageXMLRPC' => 'xmlrpc/xrLocStor.php',
|
||||||
|
|
||||||
|
// host and port of storageServer
|
||||||
|
'storageUrlHost' => 'localhost',
|
||||||
'storageUrlPort' => 80,
|
'storageUrlPort' => 80,
|
||||||
|
|
||||||
/* ================================================ archive configuration */
|
/* ================================================ remote link configuration */
|
||||||
|
// path-URL-part of remote server base dir
|
||||||
'archiveUrlPath' => '/campcaster/backend',
|
'archiveUrlPath' => '/campcaster/backend',
|
||||||
|
|
||||||
|
// XMLRPC server script address relative to archiveUrlPath
|
||||||
'archiveXMLRPC' => 'xmlrpc/xrLocStor.php',
|
'archiveXMLRPC' => 'xmlrpc/xrLocStor.php',
|
||||||
|
|
||||||
|
// host and port of archiveServer
|
||||||
'archiveUrlHost' => 'localhost',
|
'archiveUrlHost' => 'localhost',
|
||||||
// 'archiveUrlHost' => '192.168.30.166',
|
// 'archiveUrlHost' => '192.168.30.166',
|
||||||
'archiveUrlPort' => 80,
|
'archiveUrlPort' => 80,
|
||||||
|
|
||||||
|
// account info for login to archive
|
||||||
'archiveAccountLogin' => 'root',
|
'archiveAccountLogin' => 'root',
|
||||||
'archiveAccountPass' => 'q',
|
'archiveAccountPass' => 'q',
|
||||||
|
|
||||||
|
@ -143,59 +153,64 @@ $CC_CONFIG['permSequence'] = $CC_CONFIG['permTable'].'_id';
|
||||||
$CC_CONFIG['subjSequence'] = $CC_CONFIG['subjTable'].'_id';
|
$CC_CONFIG['subjSequence'] = $CC_CONFIG['subjTable'].'_id';
|
||||||
$CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id';
|
$CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id';
|
||||||
|
|
||||||
|
// system users/groups - cannot be deleted
|
||||||
$CC_CONFIG['sysSubjs'] = array(
|
$CC_CONFIG['sysSubjs'] = array(
|
||||||
'root', /*$CC_CONFIG['AdminsGr'],*/ /*$CC_CONFIG['AllGr'],*/ $CC_CONFIG['StationPrefsGr']
|
'root', /*$CC_CONFIG['AdminsGr'],*/ /*$CC_CONFIG['AllGr'],*/ $CC_CONFIG['StationPrefsGr']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add PEAR to the PHP path
|
||||||
$old_include_path = get_include_path();
|
$old_include_path = get_include_path();
|
||||||
set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'].PATH_SEPARATOR.$old_include_path);
|
set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'].PATH_SEPARATOR.$old_include_path);
|
||||||
|
|
||||||
// See if a ~/.campcaster/storageServer.conf.php exists, and
|
if (ALLOW_CONF_OVERRIDE) {
|
||||||
// overwrite the settings from there if any
|
// See if a ~/.campcaster/storageServer.conf.php exists, and
|
||||||
$this_file = null;
|
// overwrite the settings from there if any
|
||||||
if (isset($_SERVER["SCRIPT_FILENAME"])) {
|
$this_file = null;
|
||||||
$this_file = $_SERVER["SCRIPT_FILENAME"];
|
if (isset($_SERVER["SCRIPT_FILENAME"])) {
|
||||||
} elseif(isset($argv[0])) {
|
$this_file = $_SERVER["SCRIPT_FILENAME"];
|
||||||
$this_file = $argv[0];
|
} elseif(isset($argv[0])) {
|
||||||
}
|
$this_file = $argv[0];
|
||||||
if (!is_null($this_file)) {
|
}
|
||||||
$fileowner_id = fileowner($this_file);
|
if (!is_null($this_file)) {
|
||||||
$fileowner_array = posix_getpwuid($fileowner_id);
|
$fileowner_id = fileowner($this_file);
|
||||||
$fileowner_homedir = $fileowner_array['dir'];
|
$fileowner_array = posix_getpwuid($fileowner_id);
|
||||||
$fileowner_name = $fileowner_array['name'];
|
$fileowner_homedir = $fileowner_array['dir'];
|
||||||
$home_conf = $fileowner_homedir . '/.campcaster/storageServer.conf.php';
|
$fileowner_name = $fileowner_array['name'];
|
||||||
if (file_exists($home_conf)) {
|
$home_conf = $fileowner_homedir . '/.campcaster/storageServer.conf.php';
|
||||||
$default_config = $CC_CONFIG;
|
if (file_exists($home_conf)) {
|
||||||
$developer_name = $fileowner_name;
|
$default_config = $CC_CONFIG;
|
||||||
include($home_conf);
|
$developer_name = $fileowner_name;
|
||||||
$user_config = $CC_CONFIG;
|
include($home_conf);
|
||||||
$CC_CONFIG = $user_config + $default_config;
|
$user_config = $CC_CONFIG;
|
||||||
}
|
$CC_CONFIG = $user_config + $default_config;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that all the required directories exist.
|
// Check that all the required directories exist.
|
||||||
foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as $d) {
|
//foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as $d) {
|
||||||
$test = file_exists($CC_CONFIG[$d]);
|
// $test = file_exists($CC_CONFIG[$d]);
|
||||||
if ( $test === FALSE ) {
|
// if ( $test === FALSE ) {
|
||||||
echo " * Error: directory {$CC_CONFIG[$d]} is missing.\n";
|
// echo " * Error: directory {$CC_CONFIG[$d]} is missing.\n";
|
||||||
echo " * Please run the install script again.\n";
|
// echo " * Please run the install script again.\n";
|
||||||
exit(1);
|
// exit(1);
|
||||||
} else {
|
// } else {
|
||||||
$rp = realpath($CC_CONFIG[$d]);
|
// $rp = realpath($CC_CONFIG[$d]);
|
||||||
}
|
// }
|
||||||
$CC_CONFIG[$d] = $rp;
|
// $CC_CONFIG[$d] = $rp;
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Check that htmlUI/templates_c has the right permissions
|
// Check that htmlUI/templates_c has the right permissions
|
||||||
$ss=@stat($CC_CONFIG["smartyTemplateCompiled"]);
|
//$ss=@stat($CC_CONFIG["smartyTemplateCompiled"]);
|
||||||
$groupOwner = (function_exists('posix_getgrgid'))?@posix_getgrgid($ss['gid']):'';
|
//$groupOwner = (function_exists('posix_getgrgid'))?@posix_getgrgid($ss['gid']):'';
|
||||||
if (!empty($groupOwner) && ($groupOwner["name"] != $CC_CONFIG["webServerUser"])) {
|
//if (!empty($groupOwner) && ($groupOwner["name"] != $CC_CONFIG["webServerUser"])) {
|
||||||
echo " * Error: Your directory permissions for {$CC_CONFIG['smartyTemplateCompiled']} are not set correctly.<br>\n";
|
// echo " * Error: Your directory permissions for {$CC_CONFIG['smartyTemplateCompiled']} are not set correctly.<br>\n";
|
||||||
echo " * The group perms need to be set to the web server user, in this case '{$CC_CONFIG['webServerUser']}'.<br>\n";
|
// echo " * The group perms need to be set to the web server user, in this case '{$CC_CONFIG['webServerUser']}'.<br>\n";
|
||||||
exit(1);
|
// exit(1);
|
||||||
}
|
//}
|
||||||
$fileperms=@fileperms($CC_CONFIG["smartyTemplateCompiled"]);
|
//$fileperms=@fileperms($CC_CONFIG["smartyTemplateCompiled"]);
|
||||||
if (!($fileperms & 0x0400)) {
|
//if (!($fileperms & 0x0400)) {
|
||||||
echo " * Error: Sticky bit not set for {$CC_CONFIG['smartyTemplateCompiled']}.<br>\n";
|
// echo " * Error: Sticky bit not set for {$CC_CONFIG['smartyTemplateCompiled']}.<br>\n";
|
||||||
exit(1);
|
// exit(1);
|
||||||
}
|
//}
|
||||||
?>
|
?>
|
|
@ -1,480 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
|
||||||
#
|
|
||||||
# This file is part of the Campcaster project.
|
|
||||||
# http://campcaster.sourcefabric.org/
|
|
||||||
# To report bugs, send an e-mail to bugs@campware.org
|
|
||||||
#
|
|
||||||
# Campcaster is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Campcaster is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Campcaster; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Author : $Author: fgerlits $
|
|
||||||
# Version : $Revision: 2292 $
|
|
||||||
# Location : $URL: svn+ssh://tomash@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/bin/postInstallStation.sh $
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# This script makes installation steps for the Campcaster network hub.
|
|
||||||
#
|
|
||||||
# Invoke as:
|
|
||||||
# ./bin/hubSetup.sh
|
|
||||||
#
|
|
||||||
# To get usage help, try the -h option
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Determine directories, files
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
reldir=`dirname $0`/..
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
bindir=$basedir/bin
|
|
||||||
etcdir=$basedir/etc
|
|
||||||
srcdir=$basedir/src
|
|
||||||
tools_dir=$srcdir/tools
|
|
||||||
modules_dir=$srcdir/modules
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Print the usage information for this script.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
printUsage()
|
|
||||||
{
|
|
||||||
echo "Campcaster network hub install script.";
|
|
||||||
echo "parameters";
|
|
||||||
echo "";
|
|
||||||
echo " -d, --directory The installation directory, required.";
|
|
||||||
echo " -n, --hostname The remotely accessible hostname [default `hostname -f`].";
|
|
||||||
echo " -D, --database The name of the Campcaster database.";
|
|
||||||
echo " [default: CampcasterHub]";
|
|
||||||
echo " -g, --apache-group The group the apache daemon runs as.";
|
|
||||||
echo " [default: www-data]";
|
|
||||||
echo " -r, --www-root The root directory for web documents served";
|
|
||||||
echo " by apache [default: /var/www]";
|
|
||||||
echo " -s, --dbserver The name of the database server host.";
|
|
||||||
echo " [default: localhost]";
|
|
||||||
echo " -u, --dbuser The name of the database user to access the"
|
|
||||||
echo " database. [default: campcaster]";
|
|
||||||
echo " -w, --dbpassword The database user password.";
|
|
||||||
echo " [default: campcaster]";
|
|
||||||
echo " -p, --postgresql-dir The postgresql data directory, containing";
|
|
||||||
echo " pg_hba.conf [default: /etc/postgresql]";
|
|
||||||
echo " -i, --postgresql-init-script The name of the postgresql init";
|
|
||||||
echo " script [default: /etc/init.d/postgresql]";
|
|
||||||
echo " -P, --skip-postgresql Don't modify posgresql configuration.";
|
|
||||||
echo " -A, --skip-apache Don't modify apache configuration.";
|
|
||||||
echo " -h, --help Print this message and exit.";
|
|
||||||
echo "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Process command line parameters
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
CMD=${0##*/}
|
|
||||||
|
|
||||||
opts=$(getopt -o Ad:D:g:hi:n:p:Pr:s:u:w: -l apache-group:,database:,dbserver:,dbuser:,dbpassword:,directory:,help,hostname:,postgresql-dir:,postgresql-init-script:,skip-apache,skip-postgresql,www-root: -n $CMD -- "$@") || exit 1
|
|
||||||
eval set -- "$opts"
|
|
||||||
while true; do
|
|
||||||
case "$1" in
|
|
||||||
-S|--skip-apache)
|
|
||||||
skip_apache="yes";
|
|
||||||
shift;;
|
|
||||||
-d|--directory)
|
|
||||||
installdir=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-D|--database)
|
|
||||||
database=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-g|--apache-group)
|
|
||||||
apache_group=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-h|--help)
|
|
||||||
printUsage;
|
|
||||||
exit 0;;
|
|
||||||
-i|--postgresql-init-script)
|
|
||||||
postgresql_init_script=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-n|--hostname)
|
|
||||||
hostname=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-p|--postgresql-dir)
|
|
||||||
postgresql_dir=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-P|--skip-postgresql)
|
|
||||||
skip_postgresql="yes";
|
|
||||||
shift;;
|
|
||||||
-r|--www-root)
|
|
||||||
www_root=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-s|--dbserver)
|
|
||||||
dbserver=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-u|--dbuser)
|
|
||||||
dbuser=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-w|--dbpassword)
|
|
||||||
dbpassword=$2;
|
|
||||||
shift; shift;;
|
|
||||||
--)
|
|
||||||
shift;
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized option $1.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "x$installdir" == "x" ]; then
|
|
||||||
echo "Required parameter install directory not specified.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$dbserver" == "x" ]; then
|
|
||||||
dbserver=localhost;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$database" == "x" ]; then
|
|
||||||
database=CampcasterHub;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$dbuser" == "x" ]; then
|
|
||||||
dbuser=campcaster;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$dbpassword" == "x" ]; then
|
|
||||||
dbpassword=campcaster;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$apache_group" == "x" ]; then
|
|
||||||
apache_group=www-data;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$postgresql_dir" == "x" ]; then
|
|
||||||
postgresql_dir=/etc/postgresql;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$postgresql_init_script" == "x" ]; then
|
|
||||||
postgresql_init_script=/etc/init.d/postgresql;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$www_root" == "x" ]; then
|
|
||||||
www_root=/var/www;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$hostname" == "x" ]; then
|
|
||||||
hostname=`hostname -f`
|
|
||||||
fi
|
|
||||||
|
|
||||||
www_port=80
|
|
||||||
|
|
||||||
echo "Installing Campcaster network hub.";
|
|
||||||
echo "";
|
|
||||||
echo "Using the following installation parameters:";
|
|
||||||
echo "";
|
|
||||||
echo " installation directory: $installdir";
|
|
||||||
echo " database server: $dbserver";
|
|
||||||
echo " database: $database";
|
|
||||||
echo " database user: $dbuser";
|
|
||||||
echo " database user password: $dbpassword";
|
|
||||||
echo " apache daemon group: $apache_group";
|
|
||||||
echo " apache document root: $www_root";
|
|
||||||
echo " postgresql data directory: $postgresql_dir";
|
|
||||||
echo " postgresql init script: $postgresql_init_script";
|
|
||||||
echo " hostname: $hostname";
|
|
||||||
echo " www port: $www_port";
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# The details of installation
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
ls_dbserver=$dbserver
|
|
||||||
ls_dbuser=$dbuser
|
|
||||||
ls_dbpassword=$dbpassword
|
|
||||||
ls_database=$database
|
|
||||||
|
|
||||||
postgres_user=postgres
|
|
||||||
|
|
||||||
install_bin=$installdir/bin
|
|
||||||
install_etc=$installdir/etc
|
|
||||||
install_lib=$installdir/lib
|
|
||||||
install_usr=$installdir/usr
|
|
||||||
install_var_ls=$installdir/var/Campcaster
|
|
||||||
|
|
||||||
url_prefix=campcaster_hub
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Function to check for the existence of an executable on the PATH
|
|
||||||
#
|
|
||||||
# @param $1 the name of the exectuable
|
|
||||||
# @return 0 if the executable exists on the PATH, non-0 otherwise
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
check_exe() {
|
|
||||||
if [ -x "`which $1 2> /dev/null`" ]; then
|
|
||||||
echo "Executable $1 found...";
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
echo "Executable $1 not found...";
|
|
||||||
return 1;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check to see if this script is being run as root
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
if [ `whoami` != "root" ]; then
|
|
||||||
echo "Please run this script as root.";
|
|
||||||
exit ;
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check for required tools
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Checking for required tools..."
|
|
||||||
|
|
||||||
check_exe "sed" || exit 1;
|
|
||||||
check_exe "psql" || exit 1;
|
|
||||||
check_exe "php" || exit 1;
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check for the apache group to be a real group
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
group_tmp_file=/tmp/ls_group_check.$$
|
|
||||||
touch $group_tmp_file
|
|
||||||
test_result=`chgrp $apache_group $group_tmp_file 2> /dev/null`
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
rm -f $group_tmp_file;
|
|
||||||
echo "Unable to use apache deamon group $apache_group.";
|
|
||||||
echo "Please check if $apache_group is a correct user group.";
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
rm -f $group_tmp_file;
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Install the new pg_hba.conf file
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
if [ "$skip_postgresql" != "yes" ]; then
|
|
||||||
echo "Modifying postgresql access permissions...";
|
|
||||||
|
|
||||||
pg_config_dir=$postgresql_dir
|
|
||||||
pg_config_file=pg_hba.conf
|
|
||||||
pg_config_file_saved=pg_hba.conf.before-campcaster
|
|
||||||
|
|
||||||
if [ -f $pg_config_dir/$pg_config_file ] ; then
|
|
||||||
mv -vf $pg_config_dir/$pg_config_file $pg_config_dir/$pg_config_file_saved ;
|
|
||||||
fi
|
|
||||||
cp -v $etcdir/$pg_config_file $pg_config_dir/$pg_config_file
|
|
||||||
chown root:$postgres_user $pg_config_dir/$pg_config_file
|
|
||||||
|
|
||||||
# don't use restart for the init script, as it might return prematurely
|
|
||||||
# and in the later call to psql we wouldn't be able to connect
|
|
||||||
${postgresql_init_script} stop
|
|
||||||
${postgresql_init_script} start
|
|
||||||
fi
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Configuring Apache
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
if [ "$skip_apache" != "yes" ]; then
|
|
||||||
echo "Configuring apache ..."
|
|
||||||
CONFFILE=90_php_campcaster.conf
|
|
||||||
AP_DDIR_FOUND=no
|
|
||||||
for APACHE_DDIR in \
|
|
||||||
/etc/apache/conf.d /etc/apache2/conf.d /etc/apache2/conf/modules.d \
|
|
||||||
/etc/httpd/conf.d /etc/apache2/modules.d
|
|
||||||
do
|
|
||||||
echo -n "$APACHE_DDIR "
|
|
||||||
if [ -d $APACHE_DDIR ]; then
|
|
||||||
echo "Y"
|
|
||||||
AP_DDIR_FOUND=yes
|
|
||||||
cp -v $basedir/etc/apache/$CONFFILE $APACHE_DDIR
|
|
||||||
break
|
|
||||||
else
|
|
||||||
echo "N"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ "$AP_DDIR_FOUND" != "yes" ]; then
|
|
||||||
echo "###############################"
|
|
||||||
echo " Could not configure Apache"
|
|
||||||
echo " include following file into apache config manually:"
|
|
||||||
echo " $basedir/etc/apache/$CONFFILE"
|
|
||||||
echo "###############################"
|
|
||||||
else
|
|
||||||
echo "done"
|
|
||||||
echo "Restarting apache...";
|
|
||||||
AP_SCR_FOUND=no
|
|
||||||
for APACHE_SCRIPT in apache apache2 httpd ; do
|
|
||||||
echo -n "$APACHE_SCRIPT "
|
|
||||||
if [ -x /etc/init.d/$APACHE_SCRIPT ]; then
|
|
||||||
echo "Y"
|
|
||||||
AP_SCR_FOUND=yes
|
|
||||||
/etc/init.d/$APACHE_SCRIPT restart
|
|
||||||
else
|
|
||||||
echo "N"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ "$AP_SCR_FOUND" != "yes" ]; then
|
|
||||||
echo "###############################"
|
|
||||||
echo " Could not reload Apache"
|
|
||||||
echo " please reload apache manually"
|
|
||||||
echo "###############################"
|
|
||||||
fi
|
|
||||||
echo "done"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Create the necessary database user and database itself
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Creating database user '$ls_dbuser' and database '$ls_database' ...";
|
|
||||||
|
|
||||||
# FIXME: the below might not work for remote databases
|
|
||||||
|
|
||||||
if [ "x$ls_dbserver" == "xlocalhost" ]; then
|
|
||||||
su - $postgres_user -c "echo \"CREATE USER $ls_dbuser \
|
|
||||||
ENCRYPTED PASSWORD '$ls_dbpassword' \
|
|
||||||
CREATEDB NOCREATEUSER;\" \
|
|
||||||
| psql template1" \
|
|
||||||
|| echo "Couldn't create database user $ls_dbuser.";
|
|
||||||
|
|
||||||
su - $postgres_user -c "echo \"CREATE DATABASE \\\"$ls_database\\\" \
|
|
||||||
OWNER $ls_dbuser ENCODING 'utf-8';\" \
|
|
||||||
| psql template1" \
|
|
||||||
|| echo "Couldn't create database $ls_database.";
|
|
||||||
else
|
|
||||||
echo "Unable to automatically create database user and table for";
|
|
||||||
echo "remote database $ls_dbserver.";
|
|
||||||
echo "Make sure to create database user $ls_dbuser with password";
|
|
||||||
echo "$ls_dbpassword on database server at $ls_dbserver.";
|
|
||||||
echo "Also create a database called $ls_database, owned by this user.";
|
|
||||||
echo "";
|
|
||||||
echo "The easiest way to achieve this is by issuing the following SQL";
|
|
||||||
echo "commands to PostgreSQL:";
|
|
||||||
echo "CREATE USER $ls_dbuser";
|
|
||||||
echo " ENCRYPTED PASSWORD '$ls_dbpassword'";
|
|
||||||
echo " CREATEDB NOCREATEUSER;";
|
|
||||||
echo "CREATE DATABASE \"$ls_database\"";
|
|
||||||
echo " OWNER $ls_dbuser ENCODING 'utf-8';";
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: check for the success of these operations somehow
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Configuring modules
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Configuring modules ...";
|
|
||||||
|
|
||||||
cd $tools_dir/pear && ./configure --prefix=$installdir
|
|
||||||
cd $modules_dir/alib && ./configure --prefix=$installdir
|
|
||||||
cd $modules_dir/getid3 && ./configure --prefix=$installdir
|
|
||||||
#cd $modules_dir/htmlUI && ./configure --prefix=$installdir \
|
|
||||||
# --with-apache-group=$apache_group \
|
|
||||||
# --with-www-docroot=$www_root \
|
|
||||||
# --with-storage-server=$installdir/var/Campcaster/storageServer
|
|
||||||
cd $modules_dir/storageAdmin && ./configure --prefix=$installdir \
|
|
||||||
--with-storage-server=$installdir/var/Campcaster/storageServer \
|
|
||||||
--with-phppart-dir=$installdir/var/Campcaster/storageAdmin
|
|
||||||
cd $modules_dir/storageServer && \
|
|
||||||
./configure --prefix=$installdir \
|
|
||||||
--with-apache-group=$apache_group \
|
|
||||||
--with-hostname=$hostname \
|
|
||||||
--with-www-docroot=$www_root \
|
|
||||||
--with-www-port=$www_port \
|
|
||||||
--with-database-server=$dbserver \
|
|
||||||
--with-database=$database \
|
|
||||||
--with-database-user=$dbuser \
|
|
||||||
--with-database-password=$dbpassword \
|
|
||||||
--with-init-database=no \
|
|
||||||
--with-url-prefix=$url_prefix
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Install
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Installing modules ...";
|
|
||||||
|
|
||||||
mkdir -p $installdir
|
|
||||||
#$tools_dir/pear/bin/install.sh -d $installdir || exit 1
|
|
||||||
make -C $tools_dir/pear install
|
|
||||||
make -C $modules_dir/alib install
|
|
||||||
make -C $modules_dir/getid3 install
|
|
||||||
make -C $modules_dir/storageServer install
|
|
||||||
make -C $modules_dir/storageAdmin install
|
|
||||||
|
|
||||||
mkdir -p $install_var_ls/storageServer/var/tests
|
|
||||||
for it in ex1.mp3 ex2.wav; do
|
|
||||||
cp $modules_dir/storageServer/var/tests/$it \
|
|
||||||
$install_var_ls/storageServer/var/tests
|
|
||||||
done
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Create symlinks
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Creating symlinks...";
|
|
||||||
|
|
||||||
# create symlink for the PHP pages in apache's document root
|
|
||||||
webentry=$www_root/$url_prefix
|
|
||||||
rm -f $webentry
|
|
||||||
ln -vs $install_var_ls $webentry
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Setup directory permissions
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Setting up directory permissions..."
|
|
||||||
|
|
||||||
chgrp $apache_group $install_var_ls/storageServer/var/stor
|
|
||||||
chgrp $apache_group $install_var_ls/storageServer/var/access
|
|
||||||
chgrp $apache_group $install_var_ls/storageServer/var/trans
|
|
||||||
chgrp $apache_group $install_var_ls/storageServer/var/stor/buffer
|
|
||||||
|
|
||||||
chmod g+sw $install_var_ls/storageServer/var/stor
|
|
||||||
chmod g+sw $install_var_ls/storageServer/var/access
|
|
||||||
chmod g+sw $install_var_ls/storageServer/var/trans
|
|
||||||
chmod g+sw $install_var_ls/storageServer/var/stor/buffer
|
|
||||||
|
|
||||||
#chgrp $apache_group $install_var_ls/htmlUI/var/templates_c
|
|
||||||
#chgrp $apache_group $install_var_ls/htmlUI/var/html/img
|
|
||||||
|
|
||||||
#chmod g+sw $install_var_ls/htmlUI/var/templates_c
|
|
||||||
#chmod g+sw $install_var_ls/htmlUI/var/html/img
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Initialize the database
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Initializing database...";
|
|
||||||
|
|
||||||
# create PHP-related database tables
|
|
||||||
cd $install_var_ls/storageServer/var/install
|
|
||||||
php -q install.php || exit 1;
|
|
||||||
cd -
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Say goodbye
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Done."
|
|
||||||
|
|
||||||
|
|
||||||
exit
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* @subpackage StorageServer
|
* @subpackage StorageServer
|
||||||
* @copyright 2010 Sourcefabric O.P.S.
|
* @copyright 2010 Sourcefabric O.P.S.
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Do not allow remote execution
|
// Do not allow remote execution
|
||||||
|
@ -16,30 +15,55 @@ if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "*************************\n";
|
echo "**********************\n";
|
||||||
echo "* StorageServer Install *\n";
|
echo "* Campcaster Install *\n";
|
||||||
echo "*************************\n";
|
echo "**********************\n";
|
||||||
|
|
||||||
require_once(dirname(__FILE__).'/../conf.php');
|
require_once(dirname(__FILE__).'/../conf.php');
|
||||||
require_once(dirname(__FILE__).'/../backend/GreenBox.php');
|
require_once(dirname(__FILE__).'/../backend/GreenBox.php');
|
||||||
require_once(dirname(__FILE__).'/../backend/cron/Cron.php');
|
require_once(dirname(__FILE__).'/../backend/cron/Cron.php');
|
||||||
require_once(dirname(__FILE__)."/installInit.php");
|
require_once(dirname(__FILE__)."/installInit.php");
|
||||||
|
|
||||||
|
echo " *** Database Installation ***\n";
|
||||||
|
|
||||||
|
//sudo -u postgres createuser --no-superuser --no-createdb --no-createrole -A -P myuser
|
||||||
|
|
||||||
|
// Create the database user
|
||||||
|
$command = "sudo -u postgres psql postgres --command \"CREATE USER {$CC_CONFIG['dsn']['username']} "
|
||||||
|
." ENCRYPTED PASSWORD '{$CC_CONFIG['dsn']['password']}' CREATEDB NOCREATEUSER;\" 2>/dev/null";
|
||||||
|
@exec($command, $output, $results);
|
||||||
|
if ($results == 0) {
|
||||||
|
echo " * User {$CC_CONFIG['dsn']['username']} created.\n";
|
||||||
|
} else {
|
||||||
|
echo " * User {$CC_CONFIG['dsn']['username']} already exists.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$command = "sudo -u postgres createdb {$CC_CONFIG['dsn']['database']} 2> /dev/null";
|
||||||
|
@exec($command, $output, $results);
|
||||||
|
if ($results == 0) {
|
||||||
|
echo " * Database '{$CC_CONFIG['dsn']['database']}' created.\n";
|
||||||
|
} else {
|
||||||
|
echo " * Database '{$CC_CONFIG['dsn']['database']}' already exists.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connect to DB
|
||||||
campcaster_db_connect(true);
|
campcaster_db_connect(true);
|
||||||
|
|
||||||
|
// Install postgres scripting language
|
||||||
$langIsInstalled = $CC_DBC->GetOne('select count(*) FROM pg_language WHERE lanname = \'plpgsql\'');
|
$langIsInstalled = $CC_DBC->GetOne('select count(*) FROM pg_language WHERE lanname = \'plpgsql\'');
|
||||||
if ($langIsInstalled == '0') {
|
if ($langIsInstalled == '0') {
|
||||||
echo " * Installing Postgres scripting language\n";
|
echo " * Installing Postgres scripting language...\n";
|
||||||
$sql = "CREATE LANGUAGE 'plpgsql'";
|
$sql = "CREATE LANGUAGE 'plpgsql'";
|
||||||
camp_install_query($sql);
|
camp_install_query($sql);
|
||||||
} else {
|
} else {
|
||||||
echo " * Postgres scripting language already installed\n";
|
echo " * Postgres scripting language already installed\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Install database tables
|
// Install database tables
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
if (!camp_db_table_exists($CC_CONFIG['subjTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['subjTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['subjTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['subjTable']."...";
|
||||||
$sql = "CREATE TABLE ".$CC_CONFIG['subjTable']." (
|
$sql = "CREATE TABLE ".$CC_CONFIG['subjTable']." (
|
||||||
id int not null PRIMARY KEY,
|
id int not null PRIMARY KEY,
|
||||||
login varchar(255) not null default'',
|
login varchar(255) not null default'',
|
||||||
|
@ -62,11 +86,11 @@ if (!camp_db_table_exists($CC_CONFIG['subjTable'])) {
|
||||||
$CC_DBC->createSequence($CC_CONFIG['subjSequence']);
|
$CC_DBC->createSequence($CC_CONFIG['subjSequence']);
|
||||||
echo "done.\n";
|
echo "done.\n";
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['subjTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['subjTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!camp_db_table_exists($CC_CONFIG['smembTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['smembTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['smembTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['smembTable']."...";
|
||||||
$sql = "CREATE TABLE ".$CC_CONFIG['smembTable']." (
|
$sql = "CREATE TABLE ".$CC_CONFIG['smembTable']." (
|
||||||
id int not null PRIMARY KEY,
|
id int not null PRIMARY KEY,
|
||||||
uid int not null default 0,
|
uid int not null default 0,
|
||||||
|
@ -82,11 +106,11 @@ if (!camp_db_table_exists($CC_CONFIG['smembTable'])) {
|
||||||
//$CC_DBC->createSequence($CC_CONFIG['smembSequence']);
|
//$CC_DBC->createSequence($CC_CONFIG['smembSequence']);
|
||||||
echo "done.\n";
|
echo "done.\n";
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['smembTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['smembTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!camp_db_table_exists($CC_CONFIG['permTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['permTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['permTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['permTable']."...";
|
||||||
$sql = "CREATE TABLE ".$CC_CONFIG['permTable']." (
|
$sql = "CREATE TABLE ".$CC_CONFIG['permTable']." (
|
||||||
permid int not null PRIMARY KEY,
|
permid int not null PRIMARY KEY,
|
||||||
subj int REFERENCES ".$CC_CONFIG['subjTable']." ON DELETE CASCADE,
|
subj int REFERENCES ".$CC_CONFIG['subjTable']." ON DELETE CASCADE,
|
||||||
|
@ -110,11 +134,11 @@ if (!camp_db_table_exists($CC_CONFIG['permTable'])) {
|
||||||
//$CC_DBC->createSequence($CC_CONFIG['permSequence']);
|
//$CC_DBC->createSequence($CC_CONFIG['permSequence']);
|
||||||
echo "done.\n";
|
echo "done.\n";
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['permTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['permTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!camp_db_table_exists($CC_CONFIG['sessTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['sessTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['sessTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['sessTable']."...";
|
||||||
$sql = "CREATE TABLE ".$CC_CONFIG['sessTable']." (
|
$sql = "CREATE TABLE ".$CC_CONFIG['sessTable']." (
|
||||||
sessid char(32) not null PRIMARY KEY,
|
sessid char(32) not null PRIMARY KEY,
|
||||||
userid int REFERENCES ".$CC_CONFIG['subjTable']." ON DELETE CASCADE,
|
userid int REFERENCES ".$CC_CONFIG['subjTable']." ON DELETE CASCADE,
|
||||||
|
@ -134,32 +158,29 @@ if (!camp_db_table_exists($CC_CONFIG['sessTable'])) {
|
||||||
ON ".$CC_CONFIG['sessTable']." (login)";
|
ON ".$CC_CONFIG['sessTable']." (login)";
|
||||||
camp_install_query($sql);
|
camp_install_query($sql);
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['sessTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['sessTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* file states:
|
* file states:
|
||||||
* <ul>
|
* empty
|
||||||
* <li>empty</li>
|
* incomplete
|
||||||
* <li>incomplete</li>
|
* ready
|
||||||
* <li>ready</li>
|
* edited
|
||||||
* <li>edited</li>
|
* deleted
|
||||||
* <li>deleted</li>
|
*
|
||||||
* </ul>
|
|
||||||
* file types:
|
* file types:
|
||||||
* <ul>
|
* audioclip
|
||||||
* <li>audioclip</li>
|
* playlist
|
||||||
* <li>playlist</li>
|
* webstream
|
||||||
* <li>webstream</li>
|
*
|
||||||
* </ul>
|
|
||||||
* access types:
|
* access types:
|
||||||
* <ul>
|
* access
|
||||||
* <li>access</li>
|
* download
|
||||||
* <li>download</li>
|
*
|
||||||
* </ul>
|
|
||||||
*/
|
*/
|
||||||
if (!camp_db_table_exists($CC_CONFIG['filesTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['filesTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['filesTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['filesTable']."...";
|
||||||
$sql =
|
$sql =
|
||||||
"CREATE TABLE ".$CC_CONFIG['filesTable']."
|
"CREATE TABLE ".$CC_CONFIG['filesTable']."
|
||||||
(
|
(
|
||||||
|
@ -243,11 +264,11 @@ if (!camp_db_table_exists($CC_CONFIG['filesTable'])) {
|
||||||
//$CC_DBC->createSequence($CC_CONFIG['filesSequence']);
|
//$CC_DBC->createSequence($CC_CONFIG['filesSequence']);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['filesTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['filesTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!camp_db_table_exists($CC_CONFIG['playListTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['playListTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['playListTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['playListTable']."...";
|
||||||
$sql =
|
$sql =
|
||||||
"CREATE TABLE ".$CC_CONFIG['playListTable']."
|
"CREATE TABLE ".$CC_CONFIG['playListTable']."
|
||||||
(
|
(
|
||||||
|
@ -268,11 +289,11 @@ if (!camp_db_table_exists($CC_CONFIG['playListTable'])) {
|
||||||
camp_install_query($sql);
|
camp_install_query($sql);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['playListTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['playListTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!camp_db_table_exists($CC_CONFIG['playListContentsTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['playListContentsTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['playListContentsTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['playListContentsTable']."...";
|
||||||
$sql =
|
$sql =
|
||||||
"CREATE TABLE ".$CC_CONFIG['playListContentsTable']."
|
"CREATE TABLE ".$CC_CONFIG['playListContentsTable']."
|
||||||
(
|
(
|
||||||
|
@ -325,7 +346,7 @@ if (!camp_db_table_exists($CC_CONFIG['playListContentsTable'])) {
|
||||||
camp_install_query($sql);
|
camp_install_query($sql);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['playListContentsTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['playListContentsTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (!camp_db_sequence_exists($CC_CONFIG["filesSequence"])) {
|
//if (!camp_db_sequence_exists($CC_CONFIG["filesSequence"])) {
|
||||||
|
@ -343,7 +364,7 @@ if (!camp_db_table_exists($CC_CONFIG['playListContentsTable'])) {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (!camp_db_table_exists($CC_CONFIG['accessTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['accessTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['accessTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['accessTable']."...";
|
||||||
$sql = "CREATE TABLE ".$CC_CONFIG['accessTable']." (
|
$sql = "CREATE TABLE ".$CC_CONFIG['accessTable']." (
|
||||||
gunid bigint, -- global unique id
|
gunid bigint, -- global unique id
|
||||||
token bigint, -- access token
|
token bigint, -- access token
|
||||||
|
@ -368,10 +389,10 @@ if (!camp_db_table_exists($CC_CONFIG['accessTable'])) {
|
||||||
ON ".$CC_CONFIG['accessTable']." (parent)";
|
ON ".$CC_CONFIG['accessTable']." (parent)";
|
||||||
camp_install_query($sql);
|
camp_install_query($sql);
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['accessTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['accessTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo " * Inserting default users...\n";
|
echo " * Inserting default users...\n";
|
||||||
$gb = new GreenBox();
|
$gb = new GreenBox();
|
||||||
$r = $gb->initData(true);
|
$r = $gb->initData(true);
|
||||||
if (PEAR::isError($r)) {
|
if (PEAR::isError($r)) {
|
||||||
|
@ -385,7 +406,7 @@ if (PEAR::isError($r)) {
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
if (!camp_db_table_exists($CC_CONFIG['transTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['transTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['transTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['transTable']."...";
|
||||||
$sql = "CREATE TABLE ".$CC_CONFIG['transTable']." (
|
$sql = "CREATE TABLE ".$CC_CONFIG['transTable']." (
|
||||||
id int not null, -- primary key
|
id int not null, -- primary key
|
||||||
trtok char(16) not null, -- transport token
|
trtok char(16) not null, -- transport token
|
||||||
|
@ -436,14 +457,14 @@ if (!camp_db_table_exists($CC_CONFIG['transTable'])) {
|
||||||
ON ".$CC_CONFIG['transTable']." (state)";
|
ON ".$CC_CONFIG['transTable']." (state)";
|
||||||
camp_install_query($sql);
|
camp_install_query($sql);
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['transTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['transTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scheduler tables.
|
* Scheduler tables.
|
||||||
*/
|
*/
|
||||||
if (!camp_db_table_exists($CC_CONFIG['scheduleTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['scheduleTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['scheduleTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['scheduleTable']."...";
|
||||||
$sql = "CREATE TABLE ".$CC_CONFIG['scheduleTable']."("
|
$sql = "CREATE TABLE ".$CC_CONFIG['scheduleTable']."("
|
||||||
." id bigint NOT NULL,"
|
." id bigint NOT NULL,"
|
||||||
." playlist_id integer NOT NULL,"
|
." playlist_id integer NOT NULL,"
|
||||||
|
@ -460,7 +481,7 @@ if (!camp_db_table_exists($CC_CONFIG['scheduleTable'])) {
|
||||||
." CONSTRAINT unique_id UNIQUE (id))";
|
." CONSTRAINT unique_id UNIQUE (id))";
|
||||||
camp_install_query($sql);
|
camp_install_query($sql);
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['scheduleTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['scheduleTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -478,7 +499,7 @@ if (!camp_db_table_exists($CC_CONFIG['scheduleTable'])) {
|
||||||
|
|
||||||
|
|
||||||
if (!camp_db_table_exists($CC_CONFIG['backupTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['backupTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['backupTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['backupTable']."...";
|
||||||
$sql = "CREATE TABLE ".$CC_CONFIG['backupTable']." ("
|
$sql = "CREATE TABLE ".$CC_CONFIG['backupTable']." ("
|
||||||
." token VARCHAR(64) NOT NULL,"
|
." token VARCHAR(64) NOT NULL,"
|
||||||
." sessionId VARCHAR(64) NOT NULL,"
|
." sessionId VARCHAR(64) NOT NULL,"
|
||||||
|
@ -488,11 +509,11 @@ if (!camp_db_table_exists($CC_CONFIG['backupTable'])) {
|
||||||
." PRIMARY KEY(token))";
|
." PRIMARY KEY(token))";
|
||||||
camp_install_query($sql);
|
camp_install_query($sql);
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['backupTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['backupTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!camp_db_table_exists($CC_CONFIG['prefTable'])) {
|
if (!camp_db_table_exists($CC_CONFIG['prefTable'])) {
|
||||||
echo " * Creating database table ".$CC_CONFIG['prefTable']."...";
|
echo " * Creating database table ".$CC_CONFIG['prefTable']."...";
|
||||||
//$CC_DBC->createSequence($CC_CONFIG['prefSequence']);
|
//$CC_DBC->createSequence($CC_CONFIG['prefSequence']);
|
||||||
$sql = "CREATE TABLE ".$CC_CONFIG['prefTable']." (
|
$sql = "CREATE TABLE ".$CC_CONFIG['prefTable']." (
|
||||||
id int not null,
|
id int not null,
|
||||||
|
@ -514,36 +535,37 @@ if (!camp_db_table_exists($CC_CONFIG['prefTable'])) {
|
||||||
ON ".$CC_CONFIG['prefTable']." (subjid)";
|
ON ".$CC_CONFIG['prefTable']." (subjid)";
|
||||||
camp_install_query($sql);
|
camp_install_query($sql);
|
||||||
|
|
||||||
echo " * Inserting starting data into table ".$CC_CONFIG['prefTable']."...";
|
echo " * Inserting starting data into table ".$CC_CONFIG['prefTable']."...";
|
||||||
$stPrefGr = Subjects::GetSubjId($CC_CONFIG['StationPrefsGr']);
|
$stPrefGr = Subjects::GetSubjId($CC_CONFIG['StationPrefsGr']);
|
||||||
Prefs::Insert($CC_CONFIG["systemPrefId"], 'stationName', "Radio Station 1");
|
Prefs::Insert($CC_CONFIG["systemPrefId"], 'stationName', "Radio Station 1");
|
||||||
// $genres = file_get_contents( dirname(__FILE__).'/../genres.xml');
|
// $genres = file_get_contents( dirname(__FILE__).'/../genres.xml');
|
||||||
// Prefs::Insert($CC_CONFIG["systemPrefId"], 'genres', $genres);
|
// Prefs::Insert($CC_CONFIG["systemPrefId"], 'genres', $genres);
|
||||||
echo "done.\n";
|
echo "done.\n";
|
||||||
} else {
|
} else {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['prefTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['prefTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Install storage directories
|
// Install storage directories
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
echo " *** Directory Setup ***\n";
|
||||||
foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as $d) {
|
foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as $d) {
|
||||||
$test = file_exists($CC_CONFIG[$d]);
|
$test = file_exists($CC_CONFIG[$d]);
|
||||||
if ( $test === FALSE ) {
|
if ( $test === FALSE ) {
|
||||||
@mkdir($CC_CONFIG[$d], 02775);
|
@mkdir($CC_CONFIG[$d], 02775);
|
||||||
if (file_exists($CC_CONFIG[$d])) {
|
if (file_exists($CC_CONFIG[$d])) {
|
||||||
$rp = realpath($CC_CONFIG[$d]);
|
$rp = realpath($CC_CONFIG[$d]);
|
||||||
echo " * Directory $rp created\n";
|
echo " * Directory $rp created\n";
|
||||||
} else {
|
} else {
|
||||||
echo " * Failed creating {$CC_CONFIG[$d]}\n";
|
echo " * Failed creating {$CC_CONFIG[$d]}\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} elseif (is_writable($CC_CONFIG[$d])) {
|
} elseif (is_writable($CC_CONFIG[$d])) {
|
||||||
$rp = realpath($CC_CONFIG[$d]);
|
$rp = realpath($CC_CONFIG[$d]);
|
||||||
echo " * Skipping directory already exists: $rp\n";
|
echo " * Skipping directory already exists: $rp\n";
|
||||||
} else {
|
} else {
|
||||||
$rp = realpath($CC_CONFIG[$d]);
|
$rp = realpath($CC_CONFIG[$d]);
|
||||||
echo " * WARNING: Directory already exists, but is not writable: $rp\n";
|
echo " * WARNING: Directory already exists, but is not writable: $rp\n";
|
||||||
//exit(1);
|
//exit(1);
|
||||||
}
|
}
|
||||||
$CC_CONFIG[$d] = $rp;
|
$CC_CONFIG[$d] = $rp;
|
||||||
|
@ -553,16 +575,28 @@ foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as
|
||||||
// Storage directory writability test
|
// Storage directory writability test
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
echo " * Testing writability of ".$CC_CONFIG['storageDir']."...";
|
//echo " * Testing writability of ".$CC_CONFIG['storageDir']."...";
|
||||||
if (!($fp = @fopen($CC_CONFIG['storageDir']."/_writeTest", 'w'))) {
|
//if (!($fp = @fopen($CC_CONFIG['storageDir']."/_writeTest", 'w'))) {
|
||||||
echo "\nPlease make directory {$CC_CONFIG['storageDir']} writeable by your webserver".
|
// echo "\nPlease make directory {$CC_CONFIG['storageDir']} writeable by your webserver".
|
||||||
"\nand run install again\n\n";
|
// "\nand run install again\n\n";
|
||||||
exit(1);
|
// exit(1);
|
||||||
} else {
|
//} else {
|
||||||
fclose($fp);
|
// fclose($fp);
|
||||||
unlink($CC_CONFIG['storageDir']."/_writeTest");
|
// unlink($CC_CONFIG['storageDir']."/_writeTest");
|
||||||
}
|
//}
|
||||||
echo "done.\n";
|
//echo "done.\n";
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make sure the Smarty Templates Compiled directory has the right perms
|
||||||
|
//
|
||||||
|
echo " * Setting dir permissions...\n";
|
||||||
|
install_setDirPermissions($CC_CONFIG["smartyTemplateCompiled"]);
|
||||||
|
install_setDirPermissions($CC_CONFIG["storageDir"]);
|
||||||
|
install_setDirPermissions($CC_CONFIG["bufferDir"]);
|
||||||
|
install_setDirPermissions($CC_CONFIG["transDir"]);
|
||||||
|
install_setDirPermissions($CC_CONFIG["accessDir"]);
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Install Cron job
|
// Install Cron job
|
||||||
|
@ -595,8 +629,8 @@ $cron->ct->addCron($m, $h, $dom, $mon, $dow, $command);
|
||||||
$cron->closeCrontab();
|
$cron->closeCrontab();
|
||||||
echo " Done.\n";
|
echo " Done.\n";
|
||||||
|
|
||||||
echo "**********************************\n";
|
echo "*******************************\n";
|
||||||
echo "* StorageServer Install Complete *\n";
|
echo "* Campcaster Install Complete *\n";
|
||||||
echo "**********************************\n";
|
echo "*******************************\n";
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -61,4 +61,27 @@ function campcaster_db_connect($p_exitOnError = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function install_setDirPermissions($filePath) {
|
||||||
|
global $CC_CONFIG;
|
||||||
|
$success = chgrp($filePath, $CC_CONFIG["webServerUser"]);
|
||||||
|
$fileperms=@fileperms($filePath);
|
||||||
|
$fileperms = $fileperms | 0x0010; // group write bit
|
||||||
|
$fileperms = $fileperms | 0x0400; // group sticky bit
|
||||||
|
chmod($filePath, $fileperms);
|
||||||
|
|
||||||
|
// Verify Smarty template dir permissions
|
||||||
|
$fileGroup = filegroup($CC_CONFIG["smartyTemplateCompiled"]);
|
||||||
|
$groupOwner = (function_exists('posix_getgrgid'))?@posix_getgrgid($fileGroup):'';
|
||||||
|
if (!empty($groupOwner) && ($groupOwner["name"] != $CC_CONFIG["webServerUser"])) {
|
||||||
|
echo " * Error: Your directory permissions for {$filePath} are not set correctly.<br>\n";
|
||||||
|
echo " * The group perms need to be set to the web server user, in this case '{$CC_CONFIG['webServerUser']}'.<br>\n";
|
||||||
|
echo " * Currently the group is set to be '{$groupOwner['name']}'.<br>\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!($fileperms & 0x0400)) {
|
||||||
|
echo " * Error: Sticky bit not set for {$filePath}.<br>\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -1,84 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
|
||||||
#
|
|
||||||
# This file is part of the Campcaster project.
|
|
||||||
# http://campcaster.sourcefabric.org/
|
|
||||||
# To report bugs, send an e-mail to bugs@campware.org
|
|
||||||
#
|
|
||||||
# Campcaster is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Campcaster is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Campcaster; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# This script generates the nightly builds and logs.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
reldir=`dirname $0`/..
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
bindir=${basedir}/bin
|
|
||||||
tmpdir=${basedir}/tmp
|
|
||||||
logdir=${basedir}/tmp
|
|
||||||
|
|
||||||
cd ${basedir}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Update the source from the repository.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
mv -f ${logdir}/nightlySvnUpdate.log ${logdir}/nightlySvnUpdate.log~
|
|
||||||
svn update &> ${logdir}/nightlySvnUpdate.log
|
|
||||||
ls -l ${logdir}/nightlySvnUpdate.log >> ${logdir}/nightlySvnUpdate.log
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Generate the documentation.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
mv -f ${logdir}/nightlyMakeDoxygen.log ${logdir}/nightlyMakeDoxygen.log~
|
|
||||||
make doxygen &> ${logdir}/nightlyMakeDoxygen.log
|
|
||||||
ls -l ${logdir}/nightlyMakeDoxygen.log >> ${logdir}/nightlyMakeDoxygen.log
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Recompile the code.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
mv -f ${logdir}/nightlyMakeRecompile.log ${logdir}/nightlyMakeRecompile.log~
|
|
||||||
make recompile &> ${logdir}/nightlyMakeRecompile.log
|
|
||||||
ls -l ${logdir}/nightlyMakeRecompile.log >> ${logdir}/nightlyMakeRecompile.log
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Run the unit tests.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
mv -f ${logdir}/nightlyMakeCheck.log ${logdir}/nightlyMakeCheck.log~
|
|
||||||
make check &> ${logdir}/nightlyMakeCheck.log
|
|
||||||
ls -l ${logdir}/nightlyMakeCheck.log >> ${logdir}/nightlyMakeCheck.log
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Generate the test results report.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
mv -f ${logdir}/nightlyMakeTestResults.log ${logdir}/nightlyMakeTestResults.log~
|
|
||||||
make testresults &> ${logdir}/nightlyMakeTestResults.log
|
|
||||||
ls -l ${logdir}/nightlyMakeTestResults.log >> ${logdir}/nightlyMakeTestResults.log
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Generate the flawfinder report.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
mv -f ${logdir}/nightlyMakeFlawfinder.log ${logdir}/nightlyMakeFlawfinder.log~
|
|
||||||
make flawfinder &> ${logdir}/nightlyMakeFlawfinder.log
|
|
||||||
ls -l ${logdir}/nightlyMakeFlawfinder.log >> ${logdir}/nightlyMakeFlawfinder.log
|
|
||||||
|
|
|
@ -1,208 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
|
||||||
#
|
|
||||||
# This file is part of the Campcaster project.
|
|
||||||
# http://campcaster.sourcefabric.org/
|
|
||||||
# To report bugs, send an e-mail to bugs@campware.org
|
|
||||||
#
|
|
||||||
# Campcaster is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Campcaster is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Campcaster; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# A script to set up the development environment for Campcaster
|
|
||||||
#
|
|
||||||
# Invoke as:
|
|
||||||
# ./bin/setupDevelopmentEnvironmentAndLog.sh
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Determine directories, files
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
reldir=`dirname $0`/..
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
bindir=$basedir/bin
|
|
||||||
tmpdir=$basedir/tmp
|
|
||||||
logdir=$basedir/tmp
|
|
||||||
|
|
||||||
usrdir=`cd $basedir/usr; pwd;`
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Print the usage information for this script.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
printUsage()
|
|
||||||
{
|
|
||||||
echo "Campcaster development environment setup script.";
|
|
||||||
echo "parameters";
|
|
||||||
echo "";
|
|
||||||
echo " -g, --apache-group The group the apache daemon runs as.";
|
|
||||||
echo " [default: www-data]";
|
|
||||||
echo " -h, --help Print this message and exit.";
|
|
||||||
echo "";
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Process command line parameters
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
CMD=${0##*/}
|
|
||||||
|
|
||||||
opts=$(getopt -o g:h -l apache-group:,help -n $CMD -- "$@") || exit 1
|
|
||||||
eval set -- "$opts"
|
|
||||||
while true; do
|
|
||||||
case "$1" in
|
|
||||||
-g|--apache-group)
|
|
||||||
apache_group=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-h|--help)
|
|
||||||
printUsage;
|
|
||||||
exit 0;;
|
|
||||||
--)
|
|
||||||
shift;
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized option $1.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "x$apache_group" = "x" ]; then
|
|
||||||
apache_group=www-data;
|
|
||||||
fi
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# All steps are being logged
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
echo "";
|
|
||||||
echo "The compile process will be started. All steps are being logged in";
|
|
||||||
echo "$logdir ";
|
|
||||||
echo "";
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
# Cleaning the setup
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
mv -f $logdir/make_modprod_distclean_setup.log \
|
|
||||||
$logdir/make_modprod_distclean_setup.log~
|
|
||||||
make -C $basedir modprod_distclean \
|
|
||||||
> $logdir/make_modprod_distclean_setup.log 2>&1
|
|
||||||
ls -l $logdir/make_modprod_distclean_setup.log \
|
|
||||||
>> $logdir/make_modprod_distclean_setup.log
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Create the configure script, using setup parameters
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# --prefix=$usrdir --with-www-docroot=$usrdir/var =/var/www
|
|
||||||
# --with-hostname=localhost --with-apache-group=$apache_group
|
|
||||||
# --enable-debug --with-configure-apache=no =yes
|
|
||||||
#
|
|
||||||
# --with-create-database=no =yes --with-create-odbc-data-source=no =yes
|
|
||||||
# --with-init-database=no =yes --with-database=Campcaster-name
|
|
||||||
# --with-database-user=test --with-database-password=test
|
|
||||||
#
|
|
||||||
# --with-station-audio-out=default
|
|
||||||
# --with-studio-audio-out=default
|
|
||||||
# --with-studio-audio-cue=default
|
|
||||||
#
|
|
||||||
|
|
||||||
rm -rf $tmpdir/configure
|
|
||||||
echo "Now Configure ... Development Environment";
|
|
||||||
mv -f $logdir/configure_development_environment.log \
|
|
||||||
$logdir/configure_development_environment.log~
|
|
||||||
$bindir/autogen.sh \
|
|
||||||
> $logdir/configure_development_environment.log 2>&1
|
|
||||||
$basedir/configure --prefix=$usrdir --enable-debug \
|
|
||||||
--with-hostname=localhost \
|
|
||||||
--with-www-docroot=$usrdir/var \
|
|
||||||
--with-apache-group=$apache_group \
|
|
||||||
>> $logdir/configure_development_environment.log 2>&1
|
|
||||||
ls -l $logdir/configure_development_environment.log \
|
|
||||||
>> $logdir/configure_development_environment.log
|
|
||||||
echo "";
|
|
||||||
echo "Configure is done, the configure_development_environment.log is created";
|
|
||||||
echo "";
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Compile step by step
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Now Compiling ... Tools";
|
|
||||||
mv -f $logdir/make_install_tools_setup.log \
|
|
||||||
$logdir/make_install_tools_setup.log~
|
|
||||||
make -C $basedir tools_setup \
|
|
||||||
> $logdir/make_install_tools_setup.log 2>&1
|
|
||||||
ls -l $logdir/make_install_tools_setup.log \
|
|
||||||
>> $logdir/make_install_tools_setup.log
|
|
||||||
echo "Done Tools Setup, the make_install_tools_setup.log is created";
|
|
||||||
echo "";
|
|
||||||
echo "Now Compiling ... Doxytag";
|
|
||||||
mv -f $logdir/make_doxytag_setup.log \
|
|
||||||
$logdir/make_doxytag_setup.log~
|
|
||||||
make -C $basedir doxytag_setup \
|
|
||||||
> $logdir/make_doxytag_setup.log 2>&1
|
|
||||||
ls -l $logdir/make_doxytag_setup.log \
|
|
||||||
>> $logdir/make_doxytag_setup.log
|
|
||||||
echo "Done Doxytag Setup, the make_doxytag_setup.log is created";
|
|
||||||
echo "";
|
|
||||||
echo "Now Configure ... Modules ... Products";
|
|
||||||
mv -f $logdir/make_configure_modules_setup.log \
|
|
||||||
$logdir/make_configure_modules_setup.log~
|
|
||||||
make -C $basedir modules_setup \
|
|
||||||
> $logdir/make_configure_modules_setup.log 2>&1
|
|
||||||
ls -l $logdir/make_configure_modules_setup.log \
|
|
||||||
>> $logdir/make_configure_modules_setup.log
|
|
||||||
echo "Configure Modules is done, the make_configure_modules_setup.log is created";
|
|
||||||
mv -f $logdir/make_configure_products_setup.log \
|
|
||||||
$logdir/make_configure_products_setup.log~
|
|
||||||
make -C $basedir products_setup \
|
|
||||||
> $logdir/make_configure_products_setup.log 2>&1
|
|
||||||
ls -l $logdir/make_configure_products_setup.log \
|
|
||||||
>> $logdir/make_configure_products_setup.log
|
|
||||||
echo "Configure Products is done, the make_configure_products_setup.log is created";
|
|
||||||
echo "";
|
|
||||||
echo "Now Compiling ... Modules ... Products";
|
|
||||||
mv -f $logdir/make_compile_setup.log \
|
|
||||||
$logdir/make_compile_setup.log~
|
|
||||||
make -C $basedir compile \
|
|
||||||
> $logdir/make_compile_setup.log 2>&1
|
|
||||||
ls -l $logdir/make_compile_setup.log \
|
|
||||||
>> $logdir/make_compile_setup.log
|
|
||||||
echo "Compiling is done, the make_compile_setup.log is created";
|
|
||||||
echo "";
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# User setup
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Setting up user settings ...";
|
|
||||||
|
|
||||||
$bindir/user_setup.sh --apache-group=$apache_group || exit 1
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Checking what we have done
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Now Checking ...";
|
|
||||||
mv -f $logdir/make_check_setup.log \
|
|
||||||
$logdir/make_check_setup.log~
|
|
||||||
make -C $basedir check \
|
|
||||||
> $logdir/make_check_setup.log 2>&1
|
|
||||||
ls -l $logdir/make_check_setup.log \
|
|
||||||
>> $logdir/make_check_setup.log
|
|
||||||
echo "Checking is be done, the make_check_setup.log is created";
|
|
||||||
echo "";
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# We're done
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Done."
|
|
||||||
|
|
|
@ -1,236 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
|
||||||
#
|
|
||||||
# This file is part of the Campcaster project.
|
|
||||||
# http://campcaster.sourcefabric.org/
|
|
||||||
# To report bugs, send an e-mail to bugs@campware.org
|
|
||||||
#
|
|
||||||
# Campcaster is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Campcaster is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Campcaster; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# This script updates the configuration file of Campcaster Studio.
|
|
||||||
#
|
|
||||||
# Invoke as:
|
|
||||||
# ./bin/updateStudioConfig.sh
|
|
||||||
#
|
|
||||||
# To get usage help, try the -h option
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Determine directories, files
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
reldir=`dirname $0`/..
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
bindir=$basedir/bin
|
|
||||||
etcdir=$basedir/etc
|
|
||||||
docdir=$basedir/doc
|
|
||||||
tmpdir=$basedir/tmp
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Print the usage information for this script.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
printUsage()
|
|
||||||
{
|
|
||||||
echo "Campcaster Studio post-install script.";
|
|
||||||
echo "parameters";
|
|
||||||
echo "";
|
|
||||||
echo " -d, --directory The installation directory, required.";
|
|
||||||
echo " -H, --host The fully qualified host name of the system";
|
|
||||||
echo " [default: guess].";
|
|
||||||
echo " -p, --port The port of the apache web server [default: 80]"
|
|
||||||
echo " -P, --scheduler-port The port of the scheduler daemon to install"
|
|
||||||
echo " [default: 3344]";
|
|
||||||
echo " -o, --output-device The audio device of live-mode broadcast";
|
|
||||||
echo " [default: default]";
|
|
||||||
echo " -c, --cue-device The audio device of preview listening";
|
|
||||||
echo " [default: default]";
|
|
||||||
echo " -h, --help Print this message and exit.";
|
|
||||||
echo "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Process command line parameters
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
CMD=${0##*/}
|
|
||||||
|
|
||||||
opts=$(getopt -o d:H:hp:P:c:o: -l directory:,host:,help,port:,scheduler-port:,cue-device:,output-device: -n $CMD -- "$@") || exit 1
|
|
||||||
eval set -- "$opts"
|
|
||||||
while true; do
|
|
||||||
case "$1" in
|
|
||||||
-d|--directory)
|
|
||||||
installdir=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-H|--host)
|
|
||||||
hostname=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-h|--help)
|
|
||||||
printUsage;
|
|
||||||
exit 0;;
|
|
||||||
-p|--port)
|
|
||||||
http_port=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-P|--scheduler-port)
|
|
||||||
scheduler_port=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-o|--output-device)
|
|
||||||
output_alsa_device=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-c|--cue-device)
|
|
||||||
cue_alsa_device=$2;
|
|
||||||
shift; shift;;
|
|
||||||
--)
|
|
||||||
shift;
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized option $1.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "x$installdir" == "x" ]; then
|
|
||||||
echo "Required parameter install directory not specified.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$hostname" == "x" ]; then
|
|
||||||
hostname=`hostname -f`;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$http_port" == "x" ]; then
|
|
||||||
http_port=80;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$scheduler_port" == "x" ]; then
|
|
||||||
scheduler_port=3344;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$output_alsa_device" == "x" ]; then
|
|
||||||
output_alsa_device="default";
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$cue_alsa_device" == "x" ]; then
|
|
||||||
cue_alsa_device="default";
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Making post-install steps for Campcaster Studio.";
|
|
||||||
echo "";
|
|
||||||
echo "Using the following installation parameters:";
|
|
||||||
echo "";
|
|
||||||
echo " installation directory: $installdir";
|
|
||||||
echo " host name: $hostname";
|
|
||||||
echo " web server port: $http_port";
|
|
||||||
echo " scheduler port: $scheduler_port";
|
|
||||||
echo " live broadcast device: $output_alsa_device";
|
|
||||||
echo " preview device: $cue_alsa_device";
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# The details of installation
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
ls_php_host=$hostname
|
|
||||||
ls_php_port=$http_port
|
|
||||||
ls_php_urlPrefix=campcaster
|
|
||||||
|
|
||||||
ls_alib_xmlRpcPrefix="xmlrpc/xrLocStor.php"
|
|
||||||
ls_storage_xmlRpcPrefix="xmlrpc/xrLocStor.php"
|
|
||||||
|
|
||||||
ls_scheduler_host=$hostname
|
|
||||||
ls_scheduler_port=$scheduler_port
|
|
||||||
ls_scheduler_urlPrefix=
|
|
||||||
ls_scheduler_xmlRpcPrefix=RC2
|
|
||||||
ls_output_alsa_device=$output_alsa_device
|
|
||||||
ls_cue_alsa_device=$cue_alsa_device
|
|
||||||
|
|
||||||
|
|
||||||
install_bin=$installdir/bin
|
|
||||||
install_etc=$installdir/etc
|
|
||||||
install_lib=$installdir/lib
|
|
||||||
install_tmp=$installdir/tmp
|
|
||||||
install_var=$installdir/var
|
|
||||||
|
|
||||||
|
|
||||||
# replace / characters with a \/ sequence, for sed below
|
|
||||||
# the sed statement is really "s/\//\\\\\//g", but needs escaping because of
|
|
||||||
# bash, hence the extra '\' characters
|
|
||||||
install_var_s=`echo $install_var | sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_storage_xmlRpcPrefix_s=`echo $ls_storage_xmlRpcPrefix | \
|
|
||||||
sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_alib_xmlRpcPrefix_s=`echo $ls_alib_xmlRpcPrefix | sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_php_urlPrefix_s=`echo $ls_php_urlPrefix | sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_scheduler_urlPrefix_s=`echo $ls_scheduler_urlPrefix | \
|
|
||||||
sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_scheduler_xmlRpcPrefix_s=`echo $ls_scheduler_xmlRpcPrefix | \
|
|
||||||
sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_output_alsa_device_s=`echo $ls_output_alsa_device | sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_cue_alsa_device_s=`echo $ls_cue_alsa_device | sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
|
|
||||||
replace_sed_string="s/ls_var_dir/$install_var_s/; \
|
|
||||||
s/ls_php_urlPrefix/$ls_php_urlPrefix_s/; \
|
|
||||||
s/ls_php_host/$ls_php_host/; \
|
|
||||||
s/ls_php_port/$ls_php_port/; \
|
|
||||||
s/ls_alib_xmlRpcPrefix/$ls_alib_xmlRpcPrefix_s/; \
|
|
||||||
s/ls_audio_output_device/$ls_output_alsa_device_s/; \
|
|
||||||
s/ls_audio_cue_device/$ls_cue_alsa_device_s/; \
|
|
||||||
s/ls_scheduler_host/$ls_scheduler_host/; \
|
|
||||||
s/ls_scheduler_port/$ls_scheduler_port/; \
|
|
||||||
s/ls_scheduler_xmlRpcPrefix/$ls_scheduler_xmlRpcPrefix_s/;"
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Function to check for the existence of an executable on the PATH
|
|
||||||
#
|
|
||||||
# @param $1 the name of the exectuable
|
|
||||||
# @return 0 if the executable exists on the PATH, non-0 otherwise
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
check_exe() {
|
|
||||||
if [ -x "`which $1 2> /dev/null`" ]; then
|
|
||||||
echo "Executable $1 found...";
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
echo "Executable $1 not found...";
|
|
||||||
return 1;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check for required tools
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Checking for required tools..."
|
|
||||||
|
|
||||||
check_exe "sed" || exit 1;
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Customize the configuration files with the appropriate values
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Customizing configuration files..."
|
|
||||||
|
|
||||||
# customize the Campcaster Studio config file
|
|
||||||
cat $install_etc/campcaster-studio.xml.template \
|
|
||||||
| sed -e "$replace_sed_string" \
|
|
||||||
> $install_etc/campcaster-studio.xml
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Say goodbye
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Done."
|
|
||||||
|
|
|
@ -1,352 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
|
||||||
#
|
|
||||||
# This file is part of the Campcaster project.
|
|
||||||
# http://campcaster.sourcefabric.org/
|
|
||||||
# To report bugs, send an e-mail to bugs@campware.org
|
|
||||||
#
|
|
||||||
# Campcaster is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Campcaster is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Campcaster; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# This script configures the environment for a developer.
|
|
||||||
#
|
|
||||||
# Invoke as:
|
|
||||||
# ./bin/user_setup.sh
|
|
||||||
#
|
|
||||||
# To get usage help, try the -h option
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Determine directories, files
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
reldir=`dirname $0`/..
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
bindir=$basedir/bin
|
|
||||||
etcdir=$basedir/etc
|
|
||||||
docdir=$basedir/doc
|
|
||||||
srcdir=$basedir/src
|
|
||||||
tmpdir=$basedir/tmp
|
|
||||||
toolsdir=$srcdir/tools
|
|
||||||
modules_dir=$srcdir/modules
|
|
||||||
products_dir=$srcdir/products
|
|
||||||
scheduler_dir=$products_dir/scheduler
|
|
||||||
scheduler_bin_dir=$scheduler_dir/bin
|
|
||||||
|
|
||||||
usrdir=`cd $basedir/usr; pwd;`
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Print the usage information for this script.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
printUsage()
|
|
||||||
{
|
|
||||||
echo "Campcaster local user settings setup script.";
|
|
||||||
echo "parameters";
|
|
||||||
echo "";
|
|
||||||
echo " -g, --apache-group The group the apache daemon runs as.";
|
|
||||||
echo " [default: apache]";
|
|
||||||
echo " -h, --help Print this message and exit.";
|
|
||||||
echo "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Process command line parameters
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
CMD=${0##*/}
|
|
||||||
|
|
||||||
opts=$(getopt -o g:h -l apache-group:,help -n $CMD -- "$@") || exit 1
|
|
||||||
eval set -- "$opts"
|
|
||||||
while true; do
|
|
||||||
case "$1" in
|
|
||||||
-g|--apache-group)
|
|
||||||
apache_group=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-h|--help)
|
|
||||||
printUsage;
|
|
||||||
exit 0;;
|
|
||||||
--)
|
|
||||||
shift;
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized option $1.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "x$apache_group" == "x" ]; then
|
|
||||||
apache_group=apache;
|
|
||||||
fi
|
|
||||||
|
|
||||||
scheduler_base_port=3344
|
|
||||||
|
|
||||||
user=`whoami`
|
|
||||||
# force localhost always
|
|
||||||
hostname=localhost
|
|
||||||
http_port=80
|
|
||||||
scheduler_port=`expr $scheduler_base_port + $UID`
|
|
||||||
scheduler_storage_pass=change_me
|
|
||||||
dbserver=localhost
|
|
||||||
database=Campcaster-$user
|
|
||||||
dbuser=test
|
|
||||||
dbpassword=test
|
|
||||||
homedir=$HOME
|
|
||||||
configdir=$homedir/.campcaster
|
|
||||||
htmldir=$homedir/public_html
|
|
||||||
output_device=default
|
|
||||||
cue_device=default
|
|
||||||
|
|
||||||
|
|
||||||
echo "Configuring Campcaster development environment for user $user.";
|
|
||||||
echo "";
|
|
||||||
echo "Using the following installation parameters:";
|
|
||||||
echo "";
|
|
||||||
echo " host name: $hostname";
|
|
||||||
echo " web server port: $http_port";
|
|
||||||
echo " scheduler port: $scheduler_port";
|
|
||||||
echo " storage password for the scheduler: $scheduler_storage_pass";
|
|
||||||
echo " database server: $dbserver";
|
|
||||||
echo " database: $database";
|
|
||||||
echo " database user: $dbuser";
|
|
||||||
echo " database user password: $dbpassword";
|
|
||||||
echo " apache daemon group: $apache_group";
|
|
||||||
echo " home directory: $homedir";
|
|
||||||
echo " configuration directory: $configdir";
|
|
||||||
echo " web base directory: $htmldir";
|
|
||||||
echo " output audio device: $output_device";
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
|
|
||||||
# check for the apache group to be a real group
|
|
||||||
group_tmp_file=/tmp/ls_group_check.$$
|
|
||||||
touch $group_tmp_file
|
|
||||||
test_result=`chgrp $apache_group $group_tmp_file 2> /dev/null`
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
rm -f $group_tmp_file;
|
|
||||||
echo "Unable to use apache deamon group $apache_group.";
|
|
||||||
echo "Please check if $apache_group is a correct user group,";
|
|
||||||
echo "and that the current user is a member of this group.";
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
rm -f $group_tmp_file;
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# The details of installation
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
installdir=$usrdir
|
|
||||||
|
|
||||||
ls_php_host=$hostname
|
|
||||||
ls_php_port=$http_port
|
|
||||||
ls_php_urlPrefix=~$user/campcaster
|
|
||||||
|
|
||||||
ls_alib_xmlRpcPrefix="xmlrpc/xrLocStor.php"
|
|
||||||
ls_storage_xmlRpcPrefix="xmlrpc/xrLocStor.php"
|
|
||||||
|
|
||||||
ls_dbserver=$dbserver
|
|
||||||
ls_dbuser=$dbuser
|
|
||||||
ls_dbpassword=$dbpassword
|
|
||||||
ls_database=$database
|
|
||||||
|
|
||||||
ls_scheduler_host=$hostname
|
|
||||||
ls_scheduler_port=$scheduler_port
|
|
||||||
ls_scheduler_urlPrefix=
|
|
||||||
ls_scheduler_xmlRpcPrefix=RC2
|
|
||||||
ls_tmp_dir=$installdir/tmp
|
|
||||||
ls_scheduler_daemon_command="$scheduler_bin_dir/campcaster-scheduler_devenv.sh"
|
|
||||||
|
|
||||||
ls_audio_output_device=$output_device
|
|
||||||
ls_audio_cue_device=$cue_device
|
|
||||||
|
|
||||||
# replace / characters with a \/ sequence, for sed below
|
|
||||||
# the sed statement is really "s/\//\\\\\//g", but needs escaping because of
|
|
||||||
# bash, hence the extra '\' characters
|
|
||||||
installdir_s=`echo $installdir | sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_storage_xmlRpcPrefix_s=`echo $ls_storage_xmlRpcPrefix | \
|
|
||||||
sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_alib_xmlRpcPrefix_s=`echo $ls_alib_xmlRpcPrefix | sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_php_urlPrefix_s=`echo $ls_php_urlPrefix | sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_scheduler_urlPrefix_s=`echo $ls_scheduler_urlPrefix | \
|
|
||||||
sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_scheduler_xmlRpcPrefix_s=`echo $ls_scheduler_xmlRpcPrefix | \
|
|
||||||
sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_tmp_dir_s=`echo $ls_tmp_dir | sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
ls_scheduler_daemon_command_s=`echo $ls_scheduler_daemon_command | \
|
|
||||||
sed -e "s/\//\\\\\\\\\//g"`
|
|
||||||
|
|
||||||
replace_sed_string="s/ls_install_dir/$installdir_s/; \
|
|
||||||
s/ls_dbuser/$ls_dbuser/; \
|
|
||||||
s/ls_dbpassword/$ls_dbpassword/; \
|
|
||||||
s/ls_dbserver/$ls_dbserver/; \
|
|
||||||
s/ls_database/$ls_database/; \
|
|
||||||
s/ls_storageUrlPath/\/$ls_php_urlPrefix_s\/storageServer\/var/; \
|
|
||||||
s/ls_php_urlPrefix/$ls_php_urlPrefix_s/; \
|
|
||||||
s/ls_storage_xmlRpcPrefix/$ls_storage_xmlRpcPrefix_s/; \
|
|
||||||
s/ls_alib_xmlRpcPrefix/$ls_alib_xmlRpcPrefix_s/; \
|
|
||||||
s/ls_php_host/$ls_php_host/; \
|
|
||||||
s/ls_php_port/$ls_php_port/; \
|
|
||||||
s/ls_scheduler_urlPrefix/$ls_scheduler_urlPrefix_s/; \
|
|
||||||
s/ls_scheduler_xmlRpcPrefix/$ls_scheduler_xmlRpcPrefix_s/; \
|
|
||||||
s/ls_scheduler_host/$ls_scheduler_host/; \
|
|
||||||
s/ls_scheduler_port/$ls_scheduler_port/; \
|
|
||||||
s/ls_audio_output_device/$ls_audio_output_device/; \
|
|
||||||
s/ls_audio_cue_device/$ls_audio_cue_device/; \
|
|
||||||
s/ls_tmp_dir/$ls_tmp_dir_s/; \
|
|
||||||
s/ls_scheduler_daemon_command/$ls_scheduler_daemon_command_s/; \
|
|
||||||
s/ls_scheduler_storage_pass/$scheduler_storage_pass/;"
|
|
||||||
echo
|
|
||||||
echo $replace_sed_string
|
|
||||||
echo
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Function to check for the existence of an executable on the PATH
|
|
||||||
#
|
|
||||||
# @param $1 the name of the exectuable
|
|
||||||
# @return 0 if the executable exists on the PATH, non-0 otherwise
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
check_exe() {
|
|
||||||
if [ -x "`which $1 2> /dev/null`" ]; then
|
|
||||||
echo "Executable $1 found...";
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
echo "Executable $1 not found...";
|
|
||||||
return 1;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check for required tools
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Checking for required tools..."
|
|
||||||
|
|
||||||
check_exe "sed" || exit 1;
|
|
||||||
check_exe "php" || exit 1;
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Customize the configuration files with the appropriate values
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Customizing configuration files..."
|
|
||||||
|
|
||||||
mkdir -p $configdir
|
|
||||||
|
|
||||||
cat $modules_dir/storageServer/var/conf_only.php.template \
|
|
||||||
| sed -e "$replace_sed_string" \
|
|
||||||
> $configdir/storageServer.conf.php
|
|
||||||
|
|
||||||
#cat $modules_dir/authentication/etc/webAuthentication.xml.template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/webAuthentication.xml
|
|
||||||
#
|
|
||||||
#cat $modules_dir/db/etc/connectionManagerFactory.xml.template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/connectionManagerFactory.xml
|
|
||||||
#
|
|
||||||
#cat $modules_dir/db/etc/simpleConnectionManager.xml.template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/simpleConnectionManager.xml
|
|
||||||
#
|
|
||||||
#cat $modules_dir/schedulerClient/etc/schedulerClientFactory.xml.template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/schedulerClientFactory.xml
|
|
||||||
#
|
|
||||||
#cat $modules_dir/schedulerClient/etc/schedulerDaemonXmlRpcClient.xml.template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/schedulerDaemonXmlRpcClient.xml
|
|
||||||
#
|
|
||||||
#cat $modules_dir/storageClient/etc/webAuthenticationClient.xml.template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/webAuthenticationClient.xml
|
|
||||||
#
|
|
||||||
#cat $modules_dir/storageClient/etc/webStorage.xml.template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/webStorage.xml
|
|
||||||
#
|
|
||||||
#cat $products_dir/scheduler/etc/campcaster-scheduler.xml.template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/campcaster-scheduler.xml
|
|
||||||
#
|
|
||||||
#cat $products_dir/gLiveSupport/etc/campcaster-studio.xml.user-template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/campcaster-studio.xml
|
|
||||||
#
|
|
||||||
#cat $products_dir/gLiveSupport/etc/authenticationClient.xml.user-template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/authenticationClient.xml
|
|
||||||
#
|
|
||||||
#cat $products_dir/gLiveSupport/etc/storageClient.xml.user-template \
|
|
||||||
# | sed -e "$replace_sed_string" \
|
|
||||||
# > $configdir/storageClient.xml
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Create the public html directory, and links to the PHP directories
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Creating public HTML directory and links to web interfaces..."
|
|
||||||
|
|
||||||
mkdir -p $htmldir
|
|
||||||
rm -f $htmldir/campcaster
|
|
||||||
ln -s $modules_dir $htmldir/campcaster
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Setup storageServer
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Setting up storageServer..."
|
|
||||||
|
|
||||||
make -C $modules_dir/storageServer storage || exit 1
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Setup directory permissions
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Setting up directory permissions..."
|
|
||||||
|
|
||||||
chgrp $apache_group $modules_dir/storageServer/var/stor
|
|
||||||
chgrp $apache_group $modules_dir/storageServer/var/access
|
|
||||||
chgrp $apache_group $modules_dir/storageServer/var/trans
|
|
||||||
chgrp $apache_group $modules_dir/storageServer/var/stor/buffer
|
|
||||||
chmod g+sw $modules_dir/storageServer/var/stor
|
|
||||||
chmod g+sw $modules_dir/storageServer/var/access
|
|
||||||
chmod g+sw $modules_dir/storageServer/var/trans
|
|
||||||
chmod g+sw $modules_dir/storageServer/var/stor/buffer
|
|
||||||
|
|
||||||
chgrp $apache_group $modules_dir/htmlUI/var/templates_c
|
|
||||||
chgrp $apache_group $modules_dir/htmlUI/var/html/img
|
|
||||||
|
|
||||||
chmod g+sw $modules_dir/htmlUI/var/templates_c
|
|
||||||
chmod g+sw $modules_dir/htmlUI/var/html/img
|
|
||||||
|
|
||||||
cp $modules_dir/htmlUI/var/redirect.php $modules_dir/index.php
|
|
||||||
cp $modules_dir/htmlUI/var/redirect.php $modules_dir/htmlUI/index.php
|
|
||||||
cp $modules_dir/htmlUI/var/redirect.php $modules_dir/htmlUI/var/index.php
|
|
||||||
cp $modules_dir/htmlUI/var/redirect.php $modules_dir/htmlUI/var/html/index.php
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Say goodbye
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "";
|
|
||||||
echo "The HTML user interface for the Campcaster development environment";
|
|
||||||
echo "for user $user is available at:";
|
|
||||||
echo "http://$ls_php_host:$ls_php_port/$ls_php_urlPrefix/htmlUI/var";
|
|
||||||
echo "";
|
|
||||||
echo "Done."
|
|
||||||
|
|
Loading…
Reference in New Issue