Fixed some install problems due to the new directory structure.

This commit is contained in:
paul.baranowski 2010-12-07 18:11:44 -05:00
parent 728619d242
commit fb665950a1
5 changed files with 62 additions and 315 deletions

View File

@ -24,28 +24,26 @@ $CC_CONFIG = array(
/* ================================================ storage configuration */
'apiKey' => array('AAA'),
'baseFilesDir' => __DIR__."/../../files",
// main directory for storing binary media files
'storageDir' => dirname(__FILE__).'/../../stor',
'storageDir' => __DIR__.'/../../files/stor',
// directory for temporary files
'bufferDir' => dirname(__FILE__).'/../../stor/buffer',
'bufferDir' => __DIR__.'/../../files/stor/buffer',
// directory for incomplete transferred files
'transDir' => dirname(__FILE__).'/trans',
'transDir' => __DIR__.'/../../files/trans',
// directory for symlinks to accessed files
'accessDir' => dirname(__FILE__).'/access',
'cronDir' => dirname(__FILE__).'/backend/cron',
'accessDir' => __DIR__.'/../../files/access',
'cronDir' => __DIR__.'/../../files/cron',
"rootDir" => __DIR__."/../..",
'pearPath' => dirname(__FILE__).'/../../library/pear',
'zendPath' => dirname(__FILE__).'/../../library/Zend',
'phingPath' => dirname(__FILE__).'/../../library/phing',
"rootDir" => dirname(__FILE__),
"smartyTemplate" => dirname(__FILE__)."/htmlUI/templates",
"smartyTemplateCompiled" => dirname(__FILE__)."/htmlUI/templates_c",
'pearPath' => dirname(__FILE__).'/3rd_party/php/pear',
'zendPath' => dirname(__FILE__).'/3rd_party/php/Zend',
'phingPath' => dirname(__FILE__).'/3rd_party/php/phing',
'LogPath' => dirname(__FILE__).'/3rd_party/php/Log',
// secret token cookie name
'authCookieName'=> 'campcaster_session_id',
@ -164,30 +162,4 @@ set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath']
.PATH_SEPARATOR.$CC_CONFIG['zendPath']
.PATH_SEPARATOR.$old_include_path);
// Check that all the required directories exist.
//foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as $d) {
// $test = file_exists($CC_CONFIG[$d]);
// if ( $test === FALSE ) {
// echo " * Error: directory {$CC_CONFIG[$d]} is missing.\n";
// echo " * Please run the install script again.\n";
// exit(1);
// } else {
// $rp = realpath($CC_CONFIG[$d]);
// }
// $CC_CONFIG[$d] = $rp;
//}
// Check that htmlUI/templates_c has the right permissions
//$ss=@stat($CC_CONFIG["smartyTemplateCompiled"]);
//$groupOwner = (function_exists('posix_getgrgid'))?@posix_getgrgid($ss['gid']):'';
//if (!empty($groupOwner) && ($groupOwner["name"] != $CC_CONFIG["webServerUser"])) {
// 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";
// exit(1);
//}
//$fileperms=@fileperms($CC_CONFIG["smartyTemplateCompiled"]);
//if (!($fileperms & 0x0400)) {
// echo " * Error: Sticky bit not set for {$CC_CONFIG['smartyTemplateCompiled']}.<br>\n";
// exit(1);
//}
?>
?>

View File

@ -1,181 +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
#
#-------------------------------------------------------------------------------
# Run this script to install PEAR packages needed by Campcaster locally
# into the Campcaster usr environment.
# To read more about PEAR, see http://pear.php.net/
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
srcdir=$basedir/src
installdir=$basedir/../../usr
package="PEAR packages needed by Campcaster"
packages_required="
Archive_Tar
Console_Getopt
XML_RPC
PEAR
Calendar
DB
File
File_Find
HTML_Common
HTML_QuickForm
XML_Util
XML_Parser
XML_Beautifier
XML_Serializer
"
VERSION_Archive_Tar=Archive_Tar-1.3.1
VERSION_Console_Getopt=Console_Getopt-1.2
VERSION_XML_RPC=XML_RPC-1.5.0
VERSION_PEAR=PEAR-1.3.5
VERSION_Calendar=Calendar-0.5.2
VERSION_DB=DB-1.7.6
VERSION_File=File-1.2.0
VERSION_File_Find=File_Find-1.2.1
VERSION_HTML_Common=HTML_Common-1.2.1
VERSION_HTML_QuickForm=HTML_QuickForm-3.2.5
VERSION_XML_Util=XML_Util-1.1.1
VERSION_XML_Parser=XML_Parser-1.2.6
VERSION_XML_Beautifier=XML_Beautifier-1.1
VERSION_XML_Serializer=XML_Serializer-0.15.0
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster PEAR packages install script.";
echo " parameters:";
echo "";
echo " -d, --directory The Campcaster installation directory";
echo " -h, --help Print this message and exit.";
echo "";
}
#-------------------------------------------------------------------------------
# Process command line parameters
#-------------------------------------------------------------------------------
CMD=${0##*/}
opts=$(getopt -o d:h -l directory:,help -n $CMD -- "$@") || exit 1
eval set -- "$opts"
while true; do
case "$1" in
-d|--directory)
installdir=$2;
shift; shift;;
-h|--help)
printUsage;
exit 0;;
--)
shift;
break;;
*)
echo "Unrecognized option $1.";
printUsage;
exit 1;
esac
done
#-------------------------------------------------------------------------------
# Customize the configuration file with the appropriate values
#-------------------------------------------------------------------------------
destdir=`cd $installdir; pwd;`
peardir=$destdir/lib/pear
configtemplate=$etcdir/pear.conf.template
configfile=$destdir/etc/pear.conf
pearcmd="pear -c $configfile"
echo "Configuring $package"
echo " (with destdir: $destdir)"
mkdir -p $destdir
mkdir -p $destdir/etc
cp -pP $configtemplate $configfile
$pearcmd config-set php_dir $peardir || exit 1
$pearcmd config-set bin_dir $destdir/bin || exit 1
$pearcmd config-set doc_dir $peardir/docs || exit 1
$pearcmd config-set data_dir $peardir/data || exit 1
$pearcmd config-set cache_dir $peardir/cache || exit 1
$pearcmd config-set test_dir $peardir/tests || exit 1
$pearcmd channel-update pear.php.net
#$pearcmd config-show; exit
#-------------------------------------------------------------------------------
# Function to check for a PEAR module
#
# @param $1 the name of the PEAR module
# @return 0 if the module is available, non-0 otherwise
#-------------------------------------------------------------------------------
check_pear_module() {
test_result=`$pearcmd info $1`
if [ $? = 0 ]; then
#echo "OK"
return 0;
else
#echo "NOT installed";
return 1;
fi
}
#-------------------------------------------------------------------------------
# Install the packages
#-------------------------------------------------------------------------------
echo "Installing $package to directory:"
echo " $destdir"
cd $srcdir
for pkg in $packages_required
do echo -n " "
echo -n "$pkg: "
eval "pkgv=\$VERSION_$pkg"
check_pear_module $pkg && (
$pearcmd upgrade -f $pkgv.tgz >/dev/null && echo -n "upgrading to $pkgv"
#|| echo -n "code: $?"
) || (
# $pearcmd install $pkgv.tgz >/dev/null && echo -n "installing $pkgv" || exit 1
$pearcmd install $pkgv.tgz && echo -n "installing $pkgv" || exit 1
)
check_pear_module $pkg && echo " OK" || exit 1
done
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Install of $package finished OK."
exit 0

View File

@ -69,19 +69,19 @@ function install_setDirPermissions($filePath) {
$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);
}
// // 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);
// }
}
?>

View File

@ -19,9 +19,9 @@ echo "**********************\n";
echo "* Campcaster Install *\n";
echo "**********************\n";
require_once(dirname(__FILE__).'/../conf.php');
require_once(dirname(__FILE__).'/../backend/GreenBox.php');
require_once(dirname(__FILE__).'/../backend/cron/Cron.php');
require_once(dirname(__FILE__).'/../application/configs/conf.php');
require_once(dirname(__FILE__).'/../application/models/GreenBox.php');
//require_once(dirname(__FILE__).'/../application/models/cron/Cron.php');
require_once(dirname(__FILE__)."/installInit.php");
// Need to check that we are superuser before running this.
@ -64,7 +64,7 @@ if ($langIsInstalled == '0') {
}
// Put Propel sql files in Database
$command = "../3rd_party/php/propel/generator/bin/propel-gen ../backend/propel-db/ insert-sql";
$command = "../library/propel/generator/bin/propel-gen ../build/ insert-sql";
echo $command."\n";
@exec($command, $output, $results);
@ -121,7 +121,7 @@ Subjects::AddSubjectToGroup('scheduler', $CC_CONFIG['StationPrefsGr']);
// Install storage directories
//------------------------------------------------------------------------
echo " *** Directory Setup ***\n";
foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as $d) {
foreach (array('baseFilesDir', 'storageDir', /*'bufferDir', 'transDir', 'accessDir',*/ 'cronDir') as $d) {
$test = file_exists($CC_CONFIG[$d]);
if ( $test === FALSE ) {
@mkdir($CC_CONFIG[$d], 02775);
@ -163,43 +163,43 @@ foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as
// 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["smartyTemplateCompiled"]);
install_setDirPermissions($CC_CONFIG["storageDir"]);
install_setDirPermissions($CC_CONFIG["bufferDir"]);
install_setDirPermissions($CC_CONFIG["transDir"]);
install_setDirPermissions($CC_CONFIG["accessDir"]);
//install_setDirPermissions($CC_CONFIG["bufferDir"]);
//install_setDirPermissions($CC_CONFIG["transDir"]);
//install_setDirPermissions($CC_CONFIG["accessDir"]);
//------------------------------------------------------------------------
// Install Cron job
//------------------------------------------------------------------------
$m = '*/2';
$h ='*';
$dom = '*';
$mon = '*';
$dow = '*';
$command = realpath("{$CC_CONFIG['cronDir']}/transportCron.php");
$old_regex = '/transportCron\.php/';
echo " * Install storageServer cron job...\n";
$cron = new Cron();
$access = $cron->openCrontab('write');
if ($access != 'write') {
do {
$r = $cron->forceWriteable();
} while ($r);
}
foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) {
if (preg_match($old_regex, $line['command'])) {
echo " * Removing old entry: ".$line['command']."\n";
$cron->ct->delEntry($id);
}
}
echo " * Adding new entry: ".$command."\n";
$cron->ct->addCron($m, $h, $dom, $mon, $dow, $command);
$cron->closeCrontab();
echo " Done.\n";
//$m = '*/2';
//$h ='*';
//$dom = '*';
//$mon = '*';
//$dow = '*';
//$command = realpath("{$CC_CONFIG['cronDir']}/transportCron.php");
//$old_regex = '/transportCron\.php/';
//echo " * Install storageServer cron job...\n";
//
//$cron = new Cron();
//$access = $cron->openCrontab('write');
//if ($access != 'write') {
// do {
// $r = $cron->forceWriteable();
// } while ($r);
//}
//
//foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) {
// if (preg_match($old_regex, $line['command'])) {
// echo " * Removing old entry: ".$line['command']."\n";
// $cron->ct->delEntry($id);
// }
//}
//echo " * Adding new entry: ".$command."\n";
//$cron->ct->addCron($m, $h, $dom, $mon, $dow, $command);
//$cron->closeCrontab();
//echo " Done.\n";
echo "*******************************\n";
echo "* Campcaster Install Complete *\n";

View File

@ -1,44 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.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 runs cvs to update the Campcaster source code.
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
tmpdir=$basedir/tmp
logdir=$basedir/tmp
echo "";
echo "The Campcaster source code will be updated now ... and logged in";
echo "$logdir";
echo "";
cd $bindir/..
svn update >& $logdir/svn_update.log
ls -l $logdir/svn_update.log >> $logdir/svn_update.log
cat $logdir/svn_update.log
echo "";
echo "The svn update is done, svn_update.log is created";