From ff26a05c3e3cb410a1ae7e1fadc7544c47b326bb Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 17 Aug 2008 13:04:06 +0000 Subject: [PATCH] 2290 storageServer does not install in Ubuntu Hardy --- .../src/modules/archiveServer/etc/Makefile.in | 4 ++-- .../src/modules/storageServer/etc/Makefile.in | 6 ++--- .../src/modules/storageServer/var/conf.php | 23 +++++++++++-------- .../storageServer/var/conf.php.template | 17 ++++++++++---- .../var/install/installStorage.php | 21 ++++++++++++----- 5 files changed, 46 insertions(+), 25 deletions(-) diff --git a/campcaster/src/modules/archiveServer/etc/Makefile.in b/campcaster/src/modules/archiveServer/etc/Makefile.in index 755693066..f8d7b5245 100644 --- a/campcaster/src/modules/archiveServer/etc/Makefile.in +++ b/campcaster/src/modules/archiveServer/etc/Makefile.in @@ -181,10 +181,10 @@ dir_setup: ${DOXYGEN_DIR} bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR} db_init: - -cd var/install && php -q install.php + cd var/install && php -q install.php db_clean: - -cd var/install && php -q uninstall.php + cd var/install && php -q uninstall.php ${TMP_DIR}: ${MKDIR} ${TMP_DIR} diff --git a/campcaster/src/modules/storageServer/etc/Makefile.in b/campcaster/src/modules/storageServer/etc/Makefile.in index 931f5bdb1..5a00ba615 100644 --- a/campcaster/src/modules/storageServer/etc/Makefile.in +++ b/campcaster/src/modules/storageServer/etc/Makefile.in @@ -216,7 +216,7 @@ endif init_database: ifeq (@INIT_LS_DATABASE@,yes) - -cd ${DEST_VAR_DIR}/install && ${PHP} -q install.php + cd ${DEST_VAR_DIR}/install && ${PHP} -q install.php endif @@ -234,12 +234,12 @@ dir_setup: bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR} db_init: - -cd var/install && php -q install.php + cd var/install && php -q install.php chgrp ${APACHE_GROUP} ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR} chmod g+sw ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR} db_clean: - -cd var/install && php -q uninstall.php + cd var/install && php -q uninstall.php reset: ./bin/resetStorage.sh diff --git a/campcaster/src/modules/storageServer/var/conf.php b/campcaster/src/modules/storageServer/var/conf.php index ef845cceb..7169934df 100644 --- a/campcaster/src/modules/storageServer/var/conf.php +++ b/campcaster/src/modules/storageServer/var/conf.php @@ -166,17 +166,22 @@ if (!is_null($this_file)) { } } -// make dirpaths better (without "../") +// workaround for missing folders foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'pearPath', 'cronDir') as $d) { - $rp = realpath($CC_CONFIG[$d]); - // workaround for missing dirs -// if ( $rp === FALSE ) { -// mkdir( $CC_CONFIG[$d] ); -// $rp = realpath($CC_CONFIG[$d]); -// } - if ($rp) { - $CC_CONFIG[$d] = $rp; + $test = file_exists($CC_CONFIG[$d]); + if ( $test === FALSE ) { + @mkdir($CC_CONFIG[$d], 02775); + if (file_exists($CC_CONFIG[$d])) { + $rp = realpath($CC_CONFIG[$d]); + //echo " * Directory $rp created\n"; + } else { + echo " * Failed creating {$CC_CONFIG[$d]}\n"; + exit(1); + } + } else { + $rp = realpath($CC_CONFIG[$d]); } + $CC_CONFIG[$d] = $rp; } ?> diff --git a/campcaster/src/modules/storageServer/var/conf.php.template b/campcaster/src/modules/storageServer/var/conf.php.template index 2b5255a58..66ab23f8a 100644 --- a/campcaster/src/modules/storageServer/var/conf.php.template +++ b/campcaster/src/modules/storageServer/var/conf.php.template @@ -142,12 +142,19 @@ $CC_CONFIG['sysSubjs'] = array( $old_ip = get_include_path(); set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'].PATH_SEPARATOR.$old_ip); -// make dirpaths better (without ../) +// workaround for missing folders foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'pearPath', 'cronDir') as $d) { - $rp = realpath($CC_CONFIG[$d]); - // workaround for missing dirs - if ( $rp === FALSE ) { - mkdir( $CC_CONFIG[$d] ); + $test = file_exists($CC_CONFIG[$d]); + if ( $test === FALSE ) { + @mkdir($CC_CONFIG[$d], 02775); + if (file_exists($CC_CONFIG[$d])) { + $rp = realpath($CC_CONFIG[$d]); + //echo " * Directory $rp created\n"; + } else { + echo " * Failed creating {$CC_CONFIG[$d]}\n"; + exit(1); + } + } else { $rp = realpath($CC_CONFIG[$d]); } $CC_CONFIG[$d] = $rp; diff --git a/campcaster/src/modules/storageServer/var/install/installStorage.php b/campcaster/src/modules/storageServer/var/install/installStorage.php index 9ca500528..b0ff05d0c 100644 --- a/campcaster/src/modules/storageServer/var/install/installStorage.php +++ b/campcaster/src/modules/storageServer/var/install/installStorage.php @@ -45,14 +45,23 @@ if (!camp_db_table_exists($CC_CONFIG['prefTable'])) { // Install storage directories //------------------------------------------------------------------------ foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'pearPath', 'cronDir') as $d) { - $rp = file_exists($CC_CONFIG[$d]); - if ( $rp === FALSE ) { - echo " * Creating directory ".$CC_CONFIG[$d]."..."; - mkdir($CC_CONFIG[$d], 02775); - echo "done.\n"; + $test = file_exists($CC_CONFIG[$d]); + if ( $test === FALSE ) { + @mkdir($CC_CONFIG[$d], 02775); + if (file_exists($CC_CONFIG[$d])) { + $rp = realpath($CC_CONFIG[$d]); + echo " * Directory $rp created\n"; + } else { + echo " * Failed creating {$CC_CONFIG[$d]}\n"; + exit(1); + } + } elseif (is_writable($CC_CONFIG[$d])) { $rp = realpath($CC_CONFIG[$d]); + echo " * Skipping directory already exists: $rp\n"; } else { - echo " * Skipping: directory already exists: $rp\n"; + $rp = realpath($CC_CONFIG[$d]); + echo " * ERROR. Directory already exists, but is not writable: $rp\n"; + exit(1); } $CC_CONFIG[$d] = $rp; }