From b340ff3bb62be585e4f5978639f739808d9c2610 Mon Sep 17 00:00:00 2001 From: "paul.baranowski" Date: Mon, 11 Oct 2010 17:22:04 +0200 Subject: [PATCH] CC-1024 Update installation/build for webapp-only Installation/uninstallation should work now. Also removed more files that are no longer needed now that Studio doesnt exist anymore. --- conf.php | 66 ++-- debian/campcaster-studio.1 | 57 --- debian/campcaster-studio.dirs | 4 - debian/campcaster-studio.manpages | 1 - debian/campcaster-studio.menu | 6 - debian/patches/apache_setup.diff | 16 - debian/patches/debianize_paths.diff | 407 +------------------- debian/patches/fix_storageClient_tests.diff | 28 -- debian/patches/fix_xml_paths.diff | 52 --- debian/patches/gconfsink.diff | 27 -- debian/patches/postgres_fixes.diff | 45 +-- debian/patches/series | 4 +- install/install.php | 51 +-- install/test_setup_db.sh | 78 ---- install/uninstall.php | 336 +++++++++------- install/user_setup_db.sh | 135 ------- 16 files changed, 254 insertions(+), 1059 deletions(-) delete mode 100644 debian/campcaster-studio.1 delete mode 100644 debian/campcaster-studio.dirs delete mode 100644 debian/campcaster-studio.manpages delete mode 100644 debian/campcaster-studio.menu delete mode 100644 debian/patches/fix_storageClient_tests.diff delete mode 100644 debian/patches/fix_xml_paths.diff delete mode 100644 debian/patches/gconfsink.diff delete mode 100755 install/test_setup_db.sh delete mode 100755 install/user_setup_db.sh diff --git a/conf.php b/conf.php index 75ac1679c..3d7cd5b8d 100644 --- a/conf.php +++ b/conf.php @@ -8,16 +8,16 @@ 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); +//define('ALLOW_CONF_OVERRIDE', false); $CC_CONFIG = array( // Database config 'dsn' => array( - 'username' => 'test2', - 'password' => 'test', + 'username' => 'campcaster', + 'password' => 'campcaster', 'hostspec' => 'localhost', 'phptype' => 'pgsql', - 'database' => 'campcaster2', + 'database' => 'campcaster', ), // Name of the web server user @@ -92,11 +92,11 @@ $CC_CONFIG = array( 'archiveAccountPass' => 'q', /* ============================================== scheduler configuration */ -// 'schedulerUrlPath' => '', -// 'schedulerXMLRPC' => 'RC2', -// 'schedulerUrlHost' => 'localhost', -// 'schedulerUrlPort' => 3344, -// 'schedulerPass' => 'change_me', + 'schedulerUrlPath' => '', + 'schedulerXMLRPC' => 'RC2', + 'schedulerUrlHost' => 'localhost', + 'schedulerUrlPort' => 3344, + 'schedulerPass' => 'change_me', /* ==================================== aplication-specific configuration */ 'objtypes' => array( @@ -162,30 +162,30 @@ $CC_CONFIG['sysSubjs'] = array( $old_include_path = get_include_path(); set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'].PATH_SEPARATOR.$old_include_path); -if (ALLOW_CONF_OVERRIDE) { - // See if a ~/.campcaster/storageServer.conf.php exists, and - // overwrite the settings from there if any - $this_file = null; - if (isset($_SERVER["SCRIPT_FILENAME"])) { - $this_file = $_SERVER["SCRIPT_FILENAME"]; - } elseif(isset($argv[0])) { - $this_file = $argv[0]; - } - if (!is_null($this_file)) { - $fileowner_id = fileowner($this_file); - $fileowner_array = posix_getpwuid($fileowner_id); - $fileowner_homedir = $fileowner_array['dir']; - $fileowner_name = $fileowner_array['name']; - $home_conf = $fileowner_homedir . '/.campcaster/storageServer.conf.php'; - if (file_exists($home_conf)) { - $default_config = $CC_CONFIG; - $developer_name = $fileowner_name; - include($home_conf); - $user_config = $CC_CONFIG; - $CC_CONFIG = $user_config + $default_config; - } - } -} +//if (ALLOW_CONF_OVERRIDE) { +// // See if a ~/.campcaster/storageServer.conf.php exists, and +// // overwrite the settings from there if any +// $this_file = null; +// if (isset($_SERVER["SCRIPT_FILENAME"])) { +// $this_file = $_SERVER["SCRIPT_FILENAME"]; +// } elseif(isset($argv[0])) { +// $this_file = $argv[0]; +// } +// if (!is_null($this_file)) { +// $fileowner_id = fileowner($this_file); +// $fileowner_array = posix_getpwuid($fileowner_id); +// $fileowner_homedir = $fileowner_array['dir']; +// $fileowner_name = $fileowner_array['name']; +// $home_conf = $fileowner_homedir . '/.campcaster/storageServer.conf.php'; +// if (file_exists($home_conf)) { +// $default_config = $CC_CONFIG; +// $developer_name = $fileowner_name; +// include($home_conf); +// $user_config = $CC_CONFIG; +// $CC_CONFIG = $user_config + $default_config; +// } +// } +//} // Check that all the required directories exist. //foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as $d) { diff --git a/debian/campcaster-studio.1 b/debian/campcaster-studio.1 deleted file mode 100644 index 603631c0c..000000000 --- a/debian/campcaster-studio.1 +++ /dev/null @@ -1,57 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" URL Macro -.de URL -\\$2 \(laURL: \\$1 \(ra\\$3 -.. -.if \n[.g] .mso www.tmac -.\" -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH CAMPCASTER\-STUDIO 1 "February 4, 2010" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -campcaster-studio \- graphical interface to campcaster radio station -.SH SYNOPSIS -.B campcaster-studio -.SH DESCRIPTION -campcaster-studio is a desktop application which connect to the -campcaster-server and allows you to do live shows or schedule automated -playback. -.PP -Campcaster is the first free and open radio management software, providing -live studio broadcast capabilities as well as the remote automation in one -integrated system. The scalability of Campcaster allows implementation in a -number of use scenarios, ranging from an unmanned broadcast unit accessed from -remote through the Internet to a local network of Campcaster machines inside a -radio station handling live broadcasts and delivering program automation by -accessing a central audio storage system. Campcaster is capable of combining -local audio files and remote web streams, supporting the widely used MP3 format -and the open equivalent OGG Vorbis. -.PP -Campcaster Studio is mainly targeted at doing live shows, though it is possible -to do automated scheduling through this interface as well. Note that the Web -component has a much more robust interface for handling automated scheduling. -.SH SEE ALSO -.BR campcaster-scheduler (1), -.BR campcaster-import (1). -.SH AUTHOR -Campcaster was written by the Media Develoment Loan Fund (MDLF) at the Center -for Advanced Media\-Prague (CAMP). -.br -For full credits see -.URL "http://www.campware.org/en/camp/about_campware/619/" "campware.org" . -.PP -This manual page was written by Robin Gareus , -for the Debian project (and may be used by others). diff --git a/debian/campcaster-studio.dirs b/debian/campcaster-studio.dirs deleted file mode 100644 index 76c14326a..000000000 --- a/debian/campcaster-studio.dirs +++ /dev/null @@ -1,4 +0,0 @@ -etc -usr/bin -usr/lib -usr/share/campcaster diff --git a/debian/campcaster-studio.manpages b/debian/campcaster-studio.manpages deleted file mode 100644 index 056508a91..000000000 --- a/debian/campcaster-studio.manpages +++ /dev/null @@ -1 +0,0 @@ -debian/campcaster-studio.1 diff --git a/debian/campcaster-studio.menu b/debian/campcaster-studio.menu deleted file mode 100644 index e3eb57752..000000000 --- a/debian/campcaster-studio.menu +++ /dev/null @@ -1,6 +0,0 @@ -?package(campcaster-studio):\ - needs="X11" \ - section="Applications/Sound"\ - title="Campcaster-Studio"\ - command="/usr/bin/campcaster-studio"\ - icon="/usr/share/pixmaps/campcaster.xpm" diff --git a/debian/patches/apache_setup.diff b/debian/patches/apache_setup.diff index 44f072278..b54ad898c 100644 --- a/debian/patches/apache_setup.diff +++ b/debian/patches/apache_setup.diff @@ -2,22 +2,6 @@ Subject: do not add symlink in /var/www/ - use apache Alias instead Forwarded: no Author: Robin Gareus Last-Update: 2010-02-14 -Index: campcaster/bin/postInstallStation.sh -=================================================================== ---- campcaster.orig/bin/postInstallStation.sh 2010-08-26 14:51:40.000000000 +0200 -+++ campcaster/bin/postInstallStation.sh 2010-08-26 14:51:45.000000000 +0200 -@@ -396,8 +396,9 @@ - echo "Creating symlinks..."; - - # create symlink for the PHP pages in apache's document root --rm -f $www_root/campcaster --ln -s $install_var_ls $www_root/campcaster -+#rm -f $www_root/campcaster -+#ln -s $install_var_ls $www_root/campcaster -+#debian: skip this -> done via apache-config in 90_php_campcaster.conf - - - #------------------------------------------------------------------------------- Index: campcaster/etc/apache/90_php_campcaster.conf =================================================================== --- campcaster.orig/etc/apache/90_php_campcaster.conf 2010-07-22 15:21:30.000000000 +0200 diff --git a/debian/patches/debianize_paths.diff b/debian/patches/debianize_paths.diff index 61efb8e5e..45b710e5a 100644 --- a/debian/patches/debianize_paths.diff +++ b/debian/patches/debianize_paths.diff @@ -3,201 +3,6 @@ Description: Change (hardcoded) paths in shell and install scripts Forwarded: not-needed Author: Robin Gareus Last-Update: 2010-02-14 -Index: campcaster/bin/postInstallStation.sh -=================================================================== ---- campcaster.orig/bin/postInstallStation.sh 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/bin/postInstallStation.sh 2010-08-26 14:51:22.000000000 +0200 -@@ -31,14 +31,6 @@ - #------------------------------------------------------------------------------- - - #------------------------------------------------------------------------------- --# Determine directories, files --#------------------------------------------------------------------------------- --reldir=`dirname $0`/.. --basedir=`cd $reldir; pwd;` --bindir=$basedir/bin -- -- --#------------------------------------------------------------------------------- - # Print the usage information for this script. - #------------------------------------------------------------------------------- - printUsage() -@@ -181,11 +173,11 @@ - postgres_user=postgres - - install_bin=$installdir/bin --install_etc=$installdir/etc --install_lib=$installdir/lib --install_usr=$installdir/usr --install_var=$installdir/var --install_var_ls=$install_var/Campcaster -+install_etc=/etc -+install_shr=/usr/share/campcaster/www/ -+install_tpl=/usr/share/campcaster/etc/ -+install_var_ls=/var/lib/campcaster/ -+storagedir=$install_var_ls/storageServer - - - #------------------------------------------------------------------------------- -@@ -281,7 +273,6 @@ - # Check whether the storage server directory has been replaced with a mount - # point for an NFS share. - #------------------------------------------------------------------------------- --storagedir=$installdir/var/storageServer - storage_is_local=yes - if [ "`mount | grep -o \"on $storagedir \"`" = "on $storagedir " ]; then - storage_is_local=no -@@ -291,6 +282,33 @@ - #------------------------------------------------------------------------------- - # Setup directory permissions - #------------------------------------------------------------------------------- -+ -+echo "Setting up links in /var..." -+ -+linkvardir() -+{ -+ mkdir -p $install_var_ls/$1 -+ test -L $install_shr/$1 || (\ -+ ls $install_shr/$1/* &>/dev/null && \ -+ cp -af $install_shr/$1/* $install_var_ls/$1/ ) -+ rm -rf $install_shr/$1 -+ ln -fs $install_var_ls/$1 $install_shr/$1 -+} -+ -+linkvardir archiveServer/var/stor -+linkvardir archiveServer/var/access -+linkvardir archiveServer/var/trans -+ -+linkvardir storageServer/var/stor -+linkvardir storageServer/var/access -+linkvardir storageServer/var/trans -+ -+linkvardir htmlUI/var/templates_c -+linkvardir htmlUI/var/html/img -+ -+mkdir -p $install_var_ls/archiveServer/var/stor/buffer -+mkdir -p $install_var_ls/storageServer/var/stor/buffer -+ - echo "Setting up directory permissions..." - - chgrp $apache_group $install_var_ls/archiveServer/var/stor -@@ -335,7 +353,7 @@ - if [ -d $APACHE_DDIR ]; then - echo "Y" - AP_DDIR_FOUND=yes -- cp $basedir/etc/apache/$CONFFILE $APACHE_DDIR -+ cp $install_tpl/$CONFFILE $APACHE_DDIR - break - else - echo "N" -@@ -345,7 +363,7 @@ - echo "###############################" - echo " Could not configure Apache" - echo " include following file into apache config manually:" -- echo " $basedir/etc/apache/$CONFFILE" -+ echo " $install_tpl/etc/apache/$CONFFILE" - echo "###############################" - fi - echo "done" -@@ -389,7 +407,7 @@ - - if [ "$storage_is_local" = "yes" ]; then - # create PHP-related database tables -- cd $install_var_ls/storageServer/var/install -+ cd $install_shr/storageServer/var/install - # workaround for #2059; restore to "exit 1" after the ticket is closed - php -q install.php || exit 1; - #php -q install.php || true -@@ -397,7 +415,7 @@ - fi - - # create PHP-related database tables --cd $install_var_ls/archiveServer/var/install -+cd $install_shr/archiveServer/var/install - # workaround for ticket #2059; restore to "exit 1" after the ticket is closed - php -q install.php || exit 1; - #php -q install.php || true -@@ -416,7 +434,7 @@ - grep -q 'ls_scheduler_storage_pass' $install_etc/campcaster-scheduler.xml - if [ $? = 0 ]; then - SCHEDULER_STORAGE_PASS=`pwgen -N1 -c -n -s` -- php -q $install_var_ls/storageServer/var/install/campcaster-user.php \ -+ php -q $install_shr/storageServer/var/install/campcaster-user.php \ - --addupdate scheduler ${SCHEDULER_STORAGE_PASS} - sed -i -e "s/ls_scheduler_storage_pass/${SCHEDULER_STORAGE_PASS}/" \ - $install_etc/campcaster-scheduler.xml -@@ -428,7 +446,7 @@ - #------------------------------------------------------------------------------- - echo "Initializing twitter cron..."; - --cd $install_var_ls/htmlUI/var/install -+cd $install_shr/htmlUI/var/install - # workaround for #2059; restore to "exit 1" after the ticket is closed - php -q install.php || exit 1; - #php -q install.php || true -@@ -436,7 +454,7 @@ - - # We need the scheduler password here too - sed -i -e "s/change_me/${SCHEDULER_STORAGE_PASS}/" \ -- $install_var_ls/htmlUI/var/html/ui_twitterCron.php -+ $install_shr/htmlUI/var/ui_twitterCron.php - - - -@@ -444,7 +462,7 @@ - # Update the database, if necessary - #------------------------------------------------------------------------------- - if [ "$storage_is_local" = "yes" ]; then -- php -q $install_var_ls/storageServer/var/install/upgrade/upgrade.php -+ php -q $install_shr/storageServer/var/install/upgrade/upgrade.php - fi - - -Index: campcaster/etc/Makefile.in -=================================================================== ---- campcaster.orig/etc/Makefile.in 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/etc/Makefile.in 2010-08-26 14:51:22.000000000 +0200 -@@ -52,7 +52,7 @@ - - USR_DIR = ${prefix} - USR_BIN_DIR = ${USR_DIR}/bin --USR_DOC_DIR = ${USR_DIR}/doc -+USR_DOC_DIR = ${USR_DIR}/share/doc/campcaster - USR_ETC_DIR = ${USR_DIR}/etc - USR_LIB_DIR = ${USR_DIR}/lib - USR_VAR_DIR = ${USR_DIR}/var -@@ -237,10 +237,10 @@ - --with-apache-group=${APACHE_GROUP} \ - --with-www-docroot=${WWW_DOCROOT} \ - --with-configure-apache=${CONFIGURE_APACHE} \ -- --with-storage-server=${prefix}/var/Campcaster/storageServer \ -+ --with-storage-server=/usr/share/campcaster/www/storageServer \ - PACKAGE_VERSION=${PACKAGE_VERSION} - cd ${STORAGE_ADMIN_DIR} && ./configure --prefix=${prefix} \ -- --with-storage-server=${prefix}/var/Campcaster/storageServer \ -+ --with-storage-server=/usr/share/campcaster/www/storageServer \ - --with-phppart-dir=${prefix}/var/Campcaster/storageAdmin \ - PACKAGE_VERSION=${PACKAGE_VERSION} - cd ${STORAGE_SERVER_DIR} && \ -Index: campcaster/src/modules/archiveServer/etc/Makefile.in -=================================================================== ---- campcaster.orig/src/modules/archiveServer/etc/Makefile.in 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/modules/archiveServer/etc/Makefile.in 2010-08-26 14:51:22.000000000 +0200 -@@ -86,11 +86,13 @@ - PHP_URL_PREFIX = @URL_PREFIX@ - - --USR_LIB_DIR_S=$(shell ${ECHO} ${USR_LIB_DIR} | ${SED} -e "s/\//\\\\\\\\\//g") -+SHR_WWW_DIR_S=$(shell ${ECHO} /usr/share/campcaster/www | ${SED} -e "s/\//\\\\\\\\\//g") -+USR_LIB_DIR_S=$(shell ${ECHO} /usr/lib/campcaster | ${SED} -e "s/\//\\\\\\\\\//g") - PHP_URL_PREFIX_S=$(shell ${ECHO} ${PHP_URL_PREFIX} | ${SED} -e "s/\//\\\\\\\\\//g") - - REPLACE_SED_STRING="s/ls_lib_dir/${USR_LIB_DIR_S}/; \ - s/ls_dbuser/${DB_USER}/; \ -+ s/ls_shr_www/${SHR_WWW_DIR_S}/; \ - s/ls_dbpassword/${DB_PASSWORD}/; \ - s/ls_dbserver/${DB_SERVER}/; \ - s/ls_database/${DATABASE}/; \ Index: campcaster/src/modules/archiveServer/var/conf.php.template =================================================================== --- campcaster.orig/src/modules/archiveServer/var/conf.php.template 2010-07-22 15:21:30.000000000 +0200 @@ -233,23 +38,6 @@ Index: campcaster/src/modules/archiveServer/var/conf.php.template -?> \ No newline at end of file +?> -Index: campcaster/src/modules/htmlUI/etc/Makefile.in -=================================================================== ---- campcaster.orig/src/modules/htmlUI/etc/Makefile.in 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/modules/htmlUI/etc/Makefile.in 2010-08-26 14:51:22.000000000 +0200 -@@ -73,7 +73,11 @@ - WWW_DOCROOT = @WWW_DOCROOT@ - STORAGE_SERVER = @STORAGE_SERVER@ - --REPLACE_SED_STRING="s\storage_server\${STORAGE_SERVER}\;" -+STORAGE_SERVER_S=$(shell ${ECHO} "${STORAGE_SERVER}" | ${SED} -e "s/\//\\\\\\\\\//g") -+HTMLUI_DIR_S=$(shell ${ECHO} "${STORAGE_SERVER}/../htmlUI/var" | ${SED} -e "s/\//\\\\\\\\\//g") -+ -+REPLACE_SED_STRING="s/storage_server/${STORAGE_SERVER_S}/;\ -+ s/htmlui_dir/${HTMLUI_DIR_S}/;" - - - #------------------------------------------------------------------------------- Index: campcaster/src/modules/htmlUI/var/ui_conf.php.template =================================================================== --- campcaster.orig/src/modules/htmlUI/var/ui_conf.php.template 2010-07-22 15:21:30.000000000 +0200 @@ -300,65 +88,6 @@ Index: campcaster/src/modules/storageAdmin/bin/dumpDbSchema.sh #------------------------------------------------------------------------------- # Print the usage information for this script. -Index: campcaster/src/modules/storageAdmin/etc/Makefile.in -=================================================================== ---- campcaster.orig/src/modules/storageAdmin/etc/Makefile.in 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/modules/storageAdmin/etc/Makefile.in 2010-08-26 14:51:22.000000000 +0200 -@@ -67,9 +67,10 @@ - - DEST_DIR = ${USR_DIR} - PHPPART_DIR = ${prefix}/var/Campcaster/storageAdmin/var -+REALPHP_DIR = /usr/share/campcaster/www/storageAdmin/var - STORAGE_SERVER = @STORAGE_SERVER@ - --PHPPART_DIR_S=$(shell ${ECHO} ${PHPPART_DIR} | ${SED} -e "s/\//\\\\\\\\\//g") -+PHPPART_DIR_S=$(shell ${ECHO} ${REALPHP_DIR} | ${SED} -e "s/\//\\\\\\\\\//g") - STORAGE_SERVER_S=$(shell ${ECHO} ${STORAGE_SERVER} | ${SED} -e "s/\//\\\\\\\\\//g") - - SED_STORAGE_SERVER="s/ls_storageServer/${STORAGE_SERVER_S}/;" -Index: campcaster/src/modules/storageServer/bin/createDatabase.sh -=================================================================== ---- campcaster.orig/src/modules/storageServer/bin/createDatabase.sh 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/modules/storageServer/bin/createDatabase.sh 2010-08-26 14:51:22.000000000 +0200 -@@ -30,18 +30,6 @@ - #------------------------------------------------------------------------------- - - #------------------------------------------------------------------------------- --# Determine directories, files --#------------------------------------------------------------------------------- --reldir=`dirname $0`/.. --basedir=`cd $reldir; pwd;` --bindir=$basedir/bin --etcdir=$basedir/etc --docdir=$basedir/doc --tmpdir=$basedir/tmp --usrdir=$basedir/usr -- -- --#------------------------------------------------------------------------------- - # Print the usage information for this script. - #------------------------------------------------------------------------------- - printUsage() -Index: campcaster/src/modules/storageServer/etc/Makefile.in -=================================================================== ---- campcaster.orig/src/modules/storageServer/etc/Makefile.in 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/modules/storageServer/etc/Makefile.in 2010-08-26 14:51:22.000000000 +0200 -@@ -95,11 +95,14 @@ - SCHEDULER_URL_PREFIX = - SCHEDULER_XML_RPC_PREFIX = RC2 - --USR_LIB_DIR_S=$(shell ${ECHO} ${USR_LIB_DIR} | ${SED} -e "s/\//\\\\\\\\\//g") -+SHR_WWW_DIR_S=$(shell ${ECHO} /usr/share/campcaster/www | ${SED} -e "s/\//\\\\\\\\\//g") -+USR_LIB_DIR_S=$(shell ${ECHO} "/usr/lib/campcaster" | ${SED} -e "s/\//\\\\\\\\\//g") -+ - PHP_URL_PREFIX_S=$(shell ${ECHO} ${PHP_URL_PREFIX} | ${SED} -e "s/\//\\\\\\\\\//g") - - REPLACE_SED_STRING="s/ls_lib_dir/${USR_LIB_DIR_S}/; \ - s/ls_dbuser/${DB_USER}/; \ -+ s/ls_shr_www/${SHR_WWW_DIR_S}/; \ - s/ls_dbpassword/${DB_PASSWORD}/; \ - s/ls_dbserver/${DB_SERVER}/; \ - s/ls_database/${DATABASE}/; \ Index: campcaster/src/modules/storageServer/var/conf.php.template =================================================================== --- campcaster.orig/src/modules/storageServer/var/conf.php.template 2010-07-22 15:21:30.000000000 +0200 @@ -395,107 +124,6 @@ Index: campcaster/src/modules/storageServer/var/conf.php.template ); // Add database table names -Index: campcaster/src/products/gLiveSupport/bin/campcaster-studio.sh -=================================================================== ---- campcaster.orig/src/products/gLiveSupport/bin/campcaster-studio.sh 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/products/gLiveSupport/bin/campcaster-studio.sh 2010-08-26 14:51:22.000000000 +0200 -@@ -29,17 +29,15 @@ - #------------------------------------------------------------------------------- - # Determine directories, files - #------------------------------------------------------------------------------- --reldir=`dirname $0`/.. --basedir=`cd $reldir; pwd;` --bindir=$basedir/bin --etcdir=$basedir/etc --libdir=$basedir/lib --tmpdir=$basedir/tmp -+bindir=/usr/lib/campcaster/bin/ -+etcdir=/etc -+libdir=/usr/lib/campcaster/ - - - #------------------------------------------------------------------------------- - # Set up the environment - #------------------------------------------------------------------------------- -+export PATH=$bindir:$PATH - export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH - export GST_REGISTRY=$etcdir/gst-registry.xml - studio_exe=$bindir/campcaster-studio -Index: campcaster/src/products/gLiveSupport/etc/Makefile.in -=================================================================== ---- campcaster.orig/src/products/gLiveSupport/etc/Makefile.in 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/products/gLiveSupport/etc/Makefile.in 2010-08-26 14:51:22.000000000 +0200 -@@ -61,6 +61,7 @@ - USR_LIB_DIR = ${USR_DIR}/lib - USR_VAR_DIR = ${USR_DIR}/var - STORAGE_TMP_DIR = "/tmp" -+REAL_SHR_DIR = "/usr/share/campcaster/www" - - HOSTNAME = @HOSTNAME@ - WWW_PORT = @WWW_PORT@ -@@ -75,9 +76,10 @@ - PHP_URL_PREFIX=campcaster - ALIB_XML_RPC_PREFIX=xmlrpc/xrLocStor.php - SCHEDULER_XML_RPC_PREFIX=RC2 --SCHEDULER_DAEMON_COMMAND="sudo ${USR_BIN_DIR}/campcaster-scheduler.sh" -+SCHEDULER_DAEMON_COMMAND="sudo /etc/init.d/campcaster" - --USR_VAR_DIR_S=$(shell ${ECHO} ${USR_VAR_DIR} | ${SED} -e "s/\//\\\\\\\\\//g") -+ -+USR_VAR_DIR_S=$(shell ${ECHO} ${REAL_SHR_DIR} | ${SED} -e "s/\//\\\\\\\\\//g") - PHP_URL_PREFIX_S=$(shell ${ECHO} ${PHP_URL_PREFIX} | \ - ${SED} -e "s/\//\\\\\\\\\//g") - ALIB_XML_RPC_PREFIX_S=$(shell ${ECHO} ${ALIB_XML_RPC_PREFIX} | \ -Index: campcaster/src/products/scheduler/bin/campcaster-scheduler.sh -=================================================================== ---- campcaster.orig/src/products/scheduler/bin/campcaster-scheduler.sh 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/products/scheduler/bin/campcaster-scheduler.sh 2010-08-26 14:51:22.000000000 +0200 -@@ -28,17 +28,15 @@ - #------------------------------------------------------------------------------- - # Determine directories, files - #------------------------------------------------------------------------------- --reldir=`dirname $0`/.. --basedir=`cd $reldir; pwd;` --bindir=$basedir/bin --etcdir=$basedir/etc --libdir=$basedir/lib --vardir=$basedir/var/Campcaster/scheduler/var -- -+bindir=/usr/lib/campcaster/bin -+etcdir=/etc -+libdir=/usr/lib/campcaster/ -+vardir=/usr/share/campcaster/www/scheduler/var - - #------------------------------------------------------------------------------- - # Set up the environment - #------------------------------------------------------------------------------- -+export PATH=$bindir:$PATH - export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH - export GST_REGISTRY=$etcdir/gst-registry.xml - scheduler_exe=$bindir/campcaster-scheduler -Index: campcaster/src/products/scheduler/bin/createDatabase.sh -=================================================================== ---- campcaster.orig/src/products/scheduler/bin/createDatabase.sh 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/products/scheduler/bin/createDatabase.sh 2010-08-26 14:51:22.000000000 +0200 -@@ -30,18 +30,6 @@ - #------------------------------------------------------------------------------- - - #------------------------------------------------------------------------------- --# Determine directories, files --#------------------------------------------------------------------------------- --reldir=`dirname $0`/.. --basedir=`cd $reldir; pwd;` --bindir=$basedir/bin --etcdir=$basedir/etc --docdir=$basedir/doc --tmpdir=$basedir/tmp --usrdir=$basedir/usr -- -- --#------------------------------------------------------------------------------- - # Print the usage information for this script. - #------------------------------------------------------------------------------- - printUsage() Index: campcaster/src/products/scheduler/bin/createOdbcDataSource.sh =================================================================== --- campcaster.orig/src/products/scheduler/bin/createOdbcDataSource.sh 2010-08-26 13:40:02.000000000 +0200 @@ -516,37 +144,4 @@ Index: campcaster/src/products/scheduler/bin/createOdbcDataSource.sh #------------------------------------------------------------------------------- # Print the usage information for this script. -Index: campcaster/src/products/scheduler/etc/Makefile.in -=================================================================== ---- campcaster.orig/src/products/scheduler/etc/Makefile.in 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/products/scheduler/etc/Makefile.in 2010-08-26 14:51:22.000000000 +0200 -@@ -76,6 +76,8 @@ - POSTGRES_USER=postgres - - USR_LIB_DIR_S=$(shell ${ECHO} ${USR_LIB_DIR} | ${SED} -e "s/\//\\\\\\\\\//g") -+STORAGE_PID_DIR_S=$(shell ${ECHO} /var/run/ | \ -+ ${SED} -e "s/\//\\\\\\\\\//g") - STORAGE_TMP_DIR_S=$(shell ${ECHO} ${STORAGE_TMP_DIR} | \ - ${SED} -e "s/\//\\\\\\\\\//g") - PHP_URL_PREFIX_S=$(shell ${ECHO} ${PHP_URL_PREFIX} | \ -@@ -95,6 +97,7 @@ - s/ls_php_port/${WWW_PORT}/; \ - s/ls_alib_xmlRpcPrefix/${ALIB_XML_RPC_PREFIX_S}/; \ - s/ls_tmp_dir/${STORAGE_TMP_DIR_S}/; \ -+ s/ls_pid_dir/${STORAGE_PID_DIR_S}/; \ - s/ls_audio_output_device/${AUDIO_OUT_S}/; \ - s/ls_scheduler_host/${HOSTNAME}/; \ - s/ls_scheduler_port/${SCHEDULER_PORT}/;" -Index: campcaster/src/products/scheduler/etc/campcaster-scheduler.xml.template -=================================================================== ---- campcaster.orig/src/products/scheduler/etc/campcaster-scheduler.xml.template 2010-07-22 15:21:30.000000000 +0200 -+++ campcaster/src/products/scheduler/etc/campcaster-scheduler.xml.template 2010-08-26 14:51:22.000000000 +0200 -@@ -124,7 +124,7 @@ - - - - + diff --git a/debian/patches/fix_storageClient_tests.diff b/debian/patches/fix_storageClient_tests.diff deleted file mode 100644 index d895f93c2..000000000 --- a/debian/patches/fix_storageClient_tests.diff +++ /dev/null @@ -1,28 +0,0 @@ -Description: change paths used during "make check" - they should be generated from .template files during - the setup stage but are not. -Author: Robin Gareus -Last-Update: 2010-02-15 -Index: campcaster/src/modules/storageClient/etc/webAuthenticationClient.xml -=================================================================== ---- campcaster.orig/src/modules/storageClient/etc/webAuthenticationClient.xml 2010-02-16 00:13:07.000000000 +0100 -+++ campcaster/src/modules/storageClient/etc/webAuthenticationClient.xml 2010-02-16 00:15:23.000000000 +0100 -@@ -14,6 +14,6 @@ - - - -+ path="/campcaster/storageServer/var/xmlrpc/xrLocStor.php" /> - - -Index: campcaster/src/modules/storageClient/etc/webStorage.xml -=================================================================== ---- campcaster.orig/src/modules/storageClient/etc/webStorage.xml 2010-02-16 00:12:34.000000000 +0100 -+++ campcaster/src/modules/storageClient/etc/webStorage.xml 2010-02-16 00:14:53.000000000 +0100 -@@ -12,5 +12,5 @@ - ]> - - -+ path="/campcaster/storageServer/var/xmlrpc/xrLocStor.php" /> - diff --git a/debian/patches/fix_xml_paths.diff b/debian/patches/fix_xml_paths.diff deleted file mode 100644 index b5d61be8d..000000000 --- a/debian/patches/fix_xml_paths.diff +++ /dev/null @@ -1,52 +0,0 @@ -Subject: Change paths in XML templates for Debian/Ubuntu -Forwarded: no -Author: Robin Gareus -Last-Update: 2010-08-26 -Index: campcaster/src/products/gLiveSupport/etc/campcaster-studio.xml.template -=================================================================== ---- campcaster.orig/src/products/gLiveSupport/etc/campcaster-studio.xml.template 2010-04-13 22:36:12.000000000 +0200 -+++ campcaster/src/products/gLiveSupport/etc/campcaster-studio.xml.template 2010-04-13 22:37:32.000000000 +0200 -@@ -140,7 +140,7 @@ - ]> - - -- - -@@ -156,9 +156,9 @@ - - - -- -+ - -- -+ - - - -@@ -196,16 +196,16 @@ - - - -- -+ - - -- -- -- -- -+ -+ -+ -+ - - -- -+ - - - diff --git a/debian/patches/gconfsink.diff b/debian/patches/gconfsink.diff deleted file mode 100644 index b0cb5b597..000000000 --- a/debian/patches/gconfsink.diff +++ /dev/null @@ -1,27 +0,0 @@ -Subject: Allow to configure the player's audio-device with gconf -Forwarded: no -Author: Robin Gareus -Last-Update: 2010-08-26 -Index: campcaster/src/modules/playlistExecutor/src/GstreamerPlayContext.h -=================================================================== ---- campcaster.orig/src/modules/playlistExecutor/src/GstreamerPlayContext.h 2010-08-26 13:40:02.000000000 +0200 -+++ campcaster/src/modules/playlistExecutor/src/GstreamerPlayContext.h 2010-08-26 14:51:50.000000000 +0200 -@@ -292,6 +292,7 @@ - // and ALSA can emulate it. - // const bool oss = m_audioDevice.find("/dev") == 0; - const bool autosink = m_audioDevice.find("auto") == 0; -+ const bool gconfsink = m_audioDevice.find("gconf") == 0; - - m_sink = gst_bin_new ("audiobin"); - if(m_sink == NULL){ -@@ -301,7 +302,9 @@ - audiopad = gst_element_get_pad (conv, "sink"); - - // set the string to be sent to gstreamer. the option here is to set it to autoaudiosink. -- GstElement *sink = (autosink ? gst_element_factory_make("autoaudiosink", NULL) : gst_element_factory_make("alsasink", NULL)); -+ GstElement *sink = (autosink ? gst_element_factory_make("autoaudiosink", NULL) : -+ (gconfsink? gst_element_factory_make("gconfaudiosink", NULL): -+ gst_element_factory_make("alsasink", NULL))); - if(sink == NULL){ - return false; - } diff --git a/debian/patches/postgres_fixes.diff b/debian/patches/postgres_fixes.diff index 1cb295f62..befd73d23 100644 --- a/debian/patches/postgres_fixes.diff +++ b/debian/patches/postgres_fixes.diff @@ -44,47 +44,4 @@ Index: campcaster/bin/postInstallStation.sh #------------------------------------------------------------------------------- -Index: campcaster/src/modules/storageServer/bin/createDatabase.sh -=================================================================== ---- campcaster.orig/src/modules/storageServer/bin/createDatabase.sh 2010-08-26 14:51:38.000000000 +0200 -+++ campcaster/src/modules/storageServer/bin/createDatabase.sh 2010-08-26 14:51:40.000000000 +0200 -@@ -171,7 +171,7 @@ - || echo "Couldn't create database user $ls_dbuser."; - - su - $postgres_user -c "echo \"CREATE DATABASE \\\"$ls_database\\\" \ -- OWNER $ls_dbuser ENCODING 'utf-8';\" \ -+ OWNER $ls_dbuser;\" \ - | psql template1" \ - || echo "Couldn't create database $ls_database."; - else -@@ -187,7 +187,7 @@ - echo " ENCRYPTED PASSWORD '$ls_dbpassword'"; - echo " CREATEDB NOCREATEUSER;"; - echo "CREATE DATABASE \"$ls_database\""; -- echo " OWNER $ls_dbuser ENCODING 'utf-8';"; -+ echo " OWNER $ls_dbuser;"; - fi - - -Index: campcaster/src/products/scheduler/bin/createDatabase.sh -=================================================================== ---- campcaster.orig/src/products/scheduler/bin/createDatabase.sh 2010-08-26 14:51:38.000000000 +0200 -+++ campcaster/src/products/scheduler/bin/createDatabase.sh 2010-08-26 14:51:40.000000000 +0200 -@@ -166,7 +166,7 @@ - || echo "Couldn't create database user $dbuser."; - - su - $postgres_user -c "echo \"CREATE DATABASE \\\"$database\\\" \ -- OWNER $dbuser ENCODING 'utf-8';\" \ -+ OWNER $dbuser;\" \ - | psql template1" \ - || echo "Couldn't create database $database."; - else -@@ -182,7 +182,7 @@ - echo " ENCRYPTED PASSWORD '$dbpassword'"; - echo " CREATEDB NOCREATEUSER;"; - echo "CREATE DATABASE \"$database\""; -- echo " OWNER $dbuser ENCODING 'utf-8';"; -+ echo " OWNER $dbuser;"; - fi - - + diff --git a/debian/patches/series b/debian/patches/series index 60b9ffd92..afa132701 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,8 +1,6 @@ remove_upstream_deb.diff icon_xpm.diff -fix_xml_paths.diff -fix_storageClient_tests.diff debianize_paths.diff postgres_fixes.diff apache_setup.diff -gconfsink.diff + diff --git a/install/install.php b/install/install.php index 021eddb30..34bcc1905 100644 --- a/install/install.php +++ b/install/install.php @@ -24,13 +24,16 @@ require_once(dirname(__FILE__).'/../backend/GreenBox.php'); require_once(dirname(__FILE__).'/../backend/cron/Cron.php'); require_once(dirname(__FILE__)."/installInit.php"); +// Need to check that we are superuser before running this. + 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"; + ." ENCRYPTED PASSWORD '{$CC_CONFIG['dsn']['password']}' LOGIN CREATEDB NOCREATEUSER;\" 2>/dev/null"; +//echo $command."\n"; @exec($command, $output, $results); if ($results == 0) { echo " * User {$CC_CONFIG['dsn']['username']} created.\n"; @@ -38,7 +41,8 @@ if ($results == 0) { echo " * User {$CC_CONFIG['dsn']['username']} already exists.\n"; } -$command = "sudo -u postgres createdb {$CC_CONFIG['dsn']['database']} 2> /dev/null"; +$command = "sudo -u postgres createdb {$CC_CONFIG['dsn']['database']} --owner {$CC_CONFIG['dsn']['username']} 2> /dev/null"; +//echo $command."\n"; @exec($command, $output, $results); if ($results == 0) { echo " * Database '{$CC_CONFIG['dsn']['database']}' created.\n"; @@ -50,11 +54,11 @@ if ($results == 0) { 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') { echo " * Installing Postgres scripting language...\n"; $sql = "CREATE LANGUAGE 'plpgsql'"; - camp_install_query($sql); + camp_install_query($sql, false); } else { echo " * Postgres scripting language already installed\n"; } @@ -392,19 +396,6 @@ if (!camp_db_table_exists($CC_CONFIG['accessTable'])) { echo " * Skipping: database table already exists: ".$CC_CONFIG['accessTable']."\n"; } -echo " * Inserting default users...\n"; -$gb = new GreenBox(); -$r = $gb->initData(true); -if (PEAR::isError($r)) { - echo "\n * ERROR: "; - print_r($r); -} -//echo "done.\n"; - -//------------------------------------------------------------------------------ -// Submodules -//------------------------------------------------------------------------------ - if (!camp_db_table_exists($CC_CONFIG['transTable'])) { echo " * Creating database table ".$CC_CONFIG['transTable']."..."; $sql = "CREATE TABLE ".$CC_CONFIG['transTable']." ( @@ -485,19 +476,6 @@ if (!camp_db_table_exists($CC_CONFIG['scheduleTable'])) { } -//if (!camp_db_table_exists($CC_CONFIG['playlogTable'])) { -// echo " * Creating database table ".$CC_CONFIG['playlogTable']."..."; -// $sql = "CREATE TABLE ".$CC_CONFIG['playlogTable']."(" -// ." id BIGINT NOT NULL," -// ." audioClipId BIGINT NOT NULL," -// ." timestamp TIMESTAMP NOT NULL," -// ." PRIMARY KEY(id))"; -// camp_install_query($sql); -//} else { -// echo " * Skipping: database table already exists: ".$CC_CONFIG['playlogTable']."\n"; -//} - - if (!camp_db_table_exists($CC_CONFIG['backupTable'])) { echo " * Creating database table ".$CC_CONFIG['backupTable']."..."; $sql = "CREATE TABLE ".$CC_CONFIG['backupTable']." (" @@ -545,6 +523,19 @@ if (!camp_db_table_exists($CC_CONFIG['prefTable'])) { echo " * Skipping: database table already exists: ".$CC_CONFIG['prefTable']."\n"; } +//------------------------------------------------------------------------ +// Install default data +//------------------------------------------------------------------------ +echo " *** Inserting Default Data ***\n"; +$gb = new GreenBox(); +$r = $gb->initData(true); +if (PEAR::isError($r)) { + echo "\n * ERROR: "; + print_r($r); +} +//echo "done.\n"; + + //------------------------------------------------------------------------ // Install storage directories //------------------------------------------------------------------------ diff --git a/install/test_setup_db.sh b/install/test_setup_db.sh deleted file mode 100755 index d8355c3ab..000000000 --- a/install/test_setup_db.sh +++ /dev/null @@ -1,78 +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 sets up the test database for Campcaster -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# 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_bindir=${scheduler_dir}/bin - -usrdir=`cd $basedir/usr; pwd;` - -installlog=/tmp/campcaster_install.log - - -#------------------------------------------------------------------------------- -# The details of the setup -#------------------------------------------------------------------------------- -ls_database=Campcaster-test -ls_dbuser=test -ls_dbpassword=test -ls_dbserver=localhost - - -#------------------------------------------------------------------------------- -# Create the necessary database user and database itself -#------------------------------------------------------------------------------- -${scheduler_bindir}/createDatabase.sh --database=${ls_database} \ - --dbuser=${ls_dbuser} \ - --dbpassword=${ls_dbpassword} \ - --dbserver=${ls_dbserver} - - -#------------------------------------------------------------------------------- -# Create the ODBC data source and driver -#------------------------------------------------------------------------------- -${scheduler_bindir}/createOdbcDataSource.sh --database=${ls_database} \ - --dbserver=${ls_dbserver} - - -#------------------------------------------------------------------------------- -# Say goodbye -#------------------------------------------------------------------------------- -echo "Done." - diff --git a/install/uninstall.php b/install/uninstall.php index 3793a0371..26ac94efb 100644 --- a/install/uninstall.php +++ b/install/uninstall.php @@ -23,43 +23,59 @@ echo "***************************\n"; require_once(dirname(__FILE__).'/../conf.php'); require_once(dirname(__FILE__).'/installInit.php'); require_once(dirname(__FILE__).'/../backend/cron/Cron.php'); -campcaster_db_connect(false); function camp_uninstall_delete_files($p_path) { if (!empty($p_path) && (strlen($p_path) > 4)) { - list($dirList,$fileList) = File_Find::maptree($p_path); - foreach ($fileList as $filepath) { - echo " * Removing $filepath..."; - @unlink($filepath); - echo "done.\n"; - } - foreach ($dirList as $dirpath) { - echo " * Removing $dirpath..."; - @rmdir($dirpath); - echo "done.\n"; + if (file_exists($p_path)) { + $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($p_path), RecursiveIteratorIterator::CHILD_FIRST); + + for ($dir->rewind(); $dir->valid(); $dir->next()) { + if ($dir->isDir()) { + rmdir($dir->getPathname()); + } else { + unlink($dir->getPathname()); + } + } + rmdir($p_path); } +// list($dirList,$fileList) = File_Find::maptree($p_path); +// foreach ($fileList as $filepath) { +// echo " * Removing file $filepath..."; +// @unlink($filepath); +// echo "done.\n"; +// } +// foreach ($dirList as $dirpath) { +// echo " * Removing directory $dirpath..."; +// @rmdir($dirpath); +// echo "done.\n"; +// } } +// echo " * Removing $p_path..."; +// @rmdir($p_path); +// echo "done.\n"; } -if (!PEAR::isError($CC_DBC)) { - if (camp_db_table_exists($CC_CONFIG['prefTable'])) { - echo " * Removing database table ".$CC_CONFIG['prefTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['prefTable']; - camp_install_query($sql, false); +//------------------------------------------------------------------------ +// Delete the database +// Note: Do not put a call to campcaster_db_connect() +// before this function, even if you called $CC_DBC->disconnect(), there will +// still be a connection to the database and you wont be able to delete it. +//------------------------------------------------------------------------ +echo " * Dropping the database '".$CC_CONFIG['dsn']['database']."'...\n"; +$command = "sudo -u postgres dropdb {$CC_CONFIG['dsn']['database']} 2> /dev/null"; +@exec($command, $output, $results); + + +//campcaster_db_connect(true); +//$CC_DBC->disconnect(); - $CC_DBC->dropSequence($CC_CONFIG['prefTable']."_id"); - echo "done.\n"; - } else { - echo " * Skipping: database table ".$CC_CONFIG['prefTable']."\n"; - } -} //------------------------------------------------------------------------ // Uninstall Cron job //------------------------------------------------------------------------ $old_regex = '/transportCron\.php/'; -echo " * Uninstall storageServer cron job...\n"; +echo " * Uninstalling cron job..."; $cron = new Cron(); $access = $cron->openCrontab('write'); @@ -68,138 +84,180 @@ if ($access != 'write') { $r = $cron->forceWriteable(); } while ($r); } - foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) { if (preg_match($old_regex, $line['command'])) { - echo " removing cron entry\n"; + //echo " removing cron entry\n"; $cron->ct->delEntry($id); } } - $cron->closeCrontab(); -echo "Done.\n"; +echo "done.\n"; +//------------------------------------------------------------------------ +// Delete files +//------------------------------------------------------------------------ camp_uninstall_delete_files($CC_CONFIG['storageDir']); camp_uninstall_delete_files($CC_CONFIG['transDir']); camp_uninstall_delete_files($CC_CONFIG['accessDir']); -if (camp_db_table_exists($CC_CONFIG['transTable'])) { - echo " * Removing database table ".$CC_CONFIG['transTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['transTable']; - camp_install_query($sql, false); - - $CC_DBC->dropSequence($CC_CONFIG['transTable']."_id"); - echo "done.\n"; -} else { - echo " * Skipping: database table ".$CC_CONFIG['transTable']."\n"; -} - -if (camp_db_table_exists($CC_CONFIG['filesTable'])) { - echo " * Removing database table ".$CC_CONFIG['filesTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['filesTable']." CASCADE"; - camp_install_query($sql); - $CC_DBC->dropSequence($CC_CONFIG['filesTable']."_id"); - -} else { - echo " * Skipping: database table ".$CC_CONFIG['filesTable']."\n"; -} - -if (camp_db_table_exists($CC_CONFIG['playListTable'])) { - echo " * Removing database table ".$CC_CONFIG['playListTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['playListTable']." CASCADE"; - camp_install_query($sql); - $CC_DBC->dropSequence($CC_CONFIG['playListTable']."_id"); - -} else { - echo " * Skipping: database table ".$CC_CONFIG['playListTable']."\n"; -} - -if (camp_db_table_exists($CC_CONFIG['playListContentsTable'])) { - echo " * Removing database table ".$CC_CONFIG['playListContentsTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['playListContentsTable']; - camp_install_query($sql); - $CC_DBC->dropSequence($CC_CONFIG['playListContentsTable']."_id"); - -} else { - echo " * Skipping: database table ".$CC_CONFIG['playListContentsTable']."\n"; -} - -//if (camp_db_sequence_exists($CC_CONFIG['filesSequence'])) { -// $sql = "DROP SEQUENCE ".$CC_CONFIG['filesSequence']; -// camp_install_query($sql); +//------------------------------------------------------------------------ +// Delete DB tables +//------------------------------------------------------------------------ +//echo " * Deleting DB tables...\n"; +//if (!PEAR::isError($CC_DBC)) { +// if (camp_db_table_exists($CC_CONFIG['prefTable'])) { +// echo " * Removing database table ".$CC_CONFIG['prefTable']."..."; +// $sql = "DROP TABLE ".$CC_CONFIG['prefTable']; +// camp_install_query($sql, false); +// +// $CC_DBC->dropSequence($CC_CONFIG['prefTable']."_id"); +// echo "done.\n"; +// } else { +// echo " * Skipping: database table ".$CC_CONFIG['prefTable']."\n"; +// } //} // -if (camp_db_table_exists($CC_CONFIG['accessTable'])) { - echo " * Removing database table ".$CC_CONFIG['accessTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['accessTable']; - camp_install_query($sql); -} else { - echo " * Skipping: database table ".$CC_CONFIG['accessTable']."\n"; -} - -if (camp_db_table_exists($CC_CONFIG['permTable'])) { - echo " * Removing database table ".$CC_CONFIG['permTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['permTable']; - camp_install_query($sql, false); - - $CC_DBC->dropSequence($CC_CONFIG['permTable']."_id"); - echo "done.\n"; -} else { - echo " * Skipping: database table ".$CC_CONFIG['permTable']."\n"; -} - -if (camp_db_table_exists($CC_CONFIG['sessTable'])) { - echo " * Removing database table ".$CC_CONFIG['sessTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['sessTable']; - camp_install_query($sql); -} else { - echo " * Skipping: database table ".$CC_CONFIG['sessTable']."\n"; -} - -if (camp_db_table_exists($CC_CONFIG['subjTable'])) { - echo " * Removing database table ".$CC_CONFIG['subjTable']."..."; - $CC_DBC->dropSequence($CC_CONFIG['subjTable']."_id"); - - $sql = "DROP TABLE ".$CC_CONFIG['subjTable']." CASCADE"; - camp_install_query($sql, false); - - echo "done.\n"; -} else { - echo " * Skipping: database table ".$CC_CONFIG['subjTable']."\n"; -} - -if (camp_db_table_exists($CC_CONFIG['smembTable'])) { - echo " * Removing database table ".$CC_CONFIG['smembTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['smembTable']; - camp_install_query($sql, false); - - $CC_DBC->dropSequence($CC_CONFIG['smembTable']."_id"); - echo "done.\n"; -} else { - echo " * Skipping: database table ".$CC_CONFIG['smembTable']."\n"; -} - -if (camp_db_table_exists($CC_CONFIG['scheduleTable'])) { - echo " * Removing database table ".$CC_CONFIG['scheduleTable']."..."; - camp_install_query("DROP TABLE ".$CC_CONFIG['scheduleTable']); -} else { - echo " * Skipping: database table ".$CC_CONFIG['scheduleTable']."\n"; -} - -if (camp_db_table_exists($CC_CONFIG['backupTable'])) { - echo " * Removing database table ".$CC_CONFIG['backupTable']."..."; - camp_install_query("DROP TABLE ".$CC_CONFIG['backupTable']); -} else { - echo " * Skipping: database table ".$CC_CONFIG['backupTable']."\n"; -} - -//if (camp_db_table_exists($CC_CONFIG['playlogTable'])) { -// echo " * Removing database table ".$CC_CONFIG['playlogTable']."..."; -// $sql = "DROP TABLE ".$CC_CONFIG['playlogTable']; +//if (camp_db_table_exists($CC_CONFIG['transTable'])) { +// echo " * Removing database table ".$CC_CONFIG['transTable']."..."; +// $sql = "DROP TABLE ".$CC_CONFIG['transTable']; +// camp_install_query($sql, false); +// +// $CC_DBC->dropSequence($CC_CONFIG['transTable']."_id"); +// echo "done.\n"; +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['transTable']."\n"; +//} +// +//if (camp_db_table_exists($CC_CONFIG['filesTable'])) { +// echo " * Removing database table ".$CC_CONFIG['filesTable']."..."; +// $sql = "DROP TABLE ".$CC_CONFIG['filesTable']." CASCADE"; +// camp_install_query($sql); +// $CC_DBC->dropSequence($CC_CONFIG['filesTable']."_id"); +// +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['filesTable']."\n"; +//} +// +//if (camp_db_table_exists($CC_CONFIG['playListTable'])) { +// echo " * Removing database table ".$CC_CONFIG['playListTable']."..."; +// $sql = "DROP TABLE ".$CC_CONFIG['playListTable']." CASCADE"; +// camp_install_query($sql); +// $CC_DBC->dropSequence($CC_CONFIG['playListTable']."_id"); +// +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['playListTable']."\n"; +//} +// +//if (camp_db_table_exists($CC_CONFIG['playListContentsTable'])) { +// echo " * Removing database table ".$CC_CONFIG['playListContentsTable']."..."; +// $sql = "DROP TABLE ".$CC_CONFIG['playListContentsTable']; +// camp_install_query($sql); +// $CC_DBC->dropSequence($CC_CONFIG['playListContentsTable']."_id"); +// +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['playListContentsTable']."\n"; +//} +// +////if (camp_db_sequence_exists($CC_CONFIG['filesSequence'])) { +//// $sql = "DROP SEQUENCE ".$CC_CONFIG['filesSequence']; +//// camp_install_query($sql); +////} +//// +//if (camp_db_table_exists($CC_CONFIG['accessTable'])) { +// echo " * Removing database table ".$CC_CONFIG['accessTable']."..."; +// $sql = "DROP TABLE ".$CC_CONFIG['accessTable']; // camp_install_query($sql); //} else { -// echo " * Skipping: database table ".$CC_CONFIG['playlogTable']."\n"; +// echo " * Skipping: database table ".$CC_CONFIG['accessTable']."\n"; //} +// +//if (camp_db_table_exists($CC_CONFIG['permTable'])) { +// echo " * Removing database table ".$CC_CONFIG['permTable']."..."; +// $sql = "DROP TABLE ".$CC_CONFIG['permTable']; +// camp_install_query($sql, false); +// +// $CC_DBC->dropSequence($CC_CONFIG['permTable']."_id"); +// echo "done.\n"; +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['permTable']."\n"; +//} +// +//if (camp_db_table_exists($CC_CONFIG['sessTable'])) { +// echo " * Removing database table ".$CC_CONFIG['sessTable']."..."; +// $sql = "DROP TABLE ".$CC_CONFIG['sessTable']; +// camp_install_query($sql); +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['sessTable']."\n"; +//} +// +//if (camp_db_table_exists($CC_CONFIG['subjTable'])) { +// echo " * Removing database table ".$CC_CONFIG['subjTable']."..."; +// $CC_DBC->dropSequence($CC_CONFIG['subjTable']."_id"); +// +// $sql = "DROP TABLE ".$CC_CONFIG['subjTable']." CASCADE"; +// camp_install_query($sql, false); +// +// echo "done.\n"; +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['subjTable']."\n"; +//} +// +//if (camp_db_table_exists($CC_CONFIG['smembTable'])) { +// echo " * Removing database table ".$CC_CONFIG['smembTable']."..."; +// $sql = "DROP TABLE ".$CC_CONFIG['smembTable']; +// camp_install_query($sql, false); +// +// $CC_DBC->dropSequence($CC_CONFIG['smembTable']."_id"); +// echo "done.\n"; +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['smembTable']."\n"; +//} +// +//if (camp_db_table_exists($CC_CONFIG['scheduleTable'])) { +// echo " * Removing database table ".$CC_CONFIG['scheduleTable']."..."; +// camp_install_query("DROP TABLE ".$CC_CONFIG['scheduleTable']); +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['scheduleTable']."\n"; +//} +// +//if (camp_db_table_exists($CC_CONFIG['backupTable'])) { +// echo " * Removing database table ".$CC_CONFIG['backupTable']."..."; +// camp_install_query("DROP TABLE ".$CC_CONFIG['backupTable']); +//} else { +// echo " * Skipping: database table ".$CC_CONFIG['backupTable']."\n"; +//} + +//------------------------------------------------------------------------ +// Disconnect from the database +//------------------------------------------------------------------------ +//echo " * Disconnecting from database...\n"; +//$CC_DBC->disconnect(); + +//------------------------------------------------------------------------ +// Delete the database +// Note: we do all the table-dropping above because this command usually fails +// because there are usually still connections to the database. +//------------------------------------------------------------------------ +//echo " * Dropping the database ".$CC_CONFIG['dsn']['database']."...\n"; +//$command = "sudo -u postgres dropdb {$CC_CONFIG['dsn']['database']}"; +//@exec($command, $output, $results); +//if ($results == 0) { +// echo " * Database '{$CC_CONFIG['dsn']['database']}' deleted.\n"; +//} else { +// echo " * Could not delete database '{$CC_CONFIG['dsn']['database']}'.\n"; +//} + +//------------------------------------------------------------------------ +// Delete the user +//------------------------------------------------------------------------ +echo " * Deleting database user '{$CC_CONFIG['dsn']['username']}'...\n"; +$command = "sudo -u postgres psql postgres --command \"DROP USER {$CC_CONFIG['dsn']['username']}\" 2> /dev/null"; +@exec($command, $output, $results); +if ($results == 0) { + echo " * User '{$CC_CONFIG['dsn']['username']}' deleted.\n"; +} else { + echo " * Nothing to delete..\n"; +} echo "************************************\n"; echo "* StorageServer Uninstall Complete *\n"; diff --git a/install/user_setup_db.sh b/install/user_setup_db.sh deleted file mode 100755 index 2783c2908..000000000 --- a/install/user_setup_db.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Campcaster project. -# http://campcaster.campware.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 sets up the development environment for a user. -# -# Invoke as: -# ./bin/user_setup_root.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_bindir=${scheduler_dir}/bin - -usrdir=`cd $basedir/usr; pwd;` - - -#------------------------------------------------------------------------------- -# Print the usage information for this script. -#------------------------------------------------------------------------------- -printUsage() -{ - echo "Campcaster user database setup script."; - echo "parameters:"; - echo ""; - echo " -u, --user The user to set up the environment for."; - echo " Required parameter."; - echo " -h, --help Print this message and exit."; - echo ""; -} - - -#------------------------------------------------------------------------------- -# Process command line parameters -#------------------------------------------------------------------------------- -CMD=${0##*/} - -opts=$(getopt -o hu: -l help,user: -n $CMD -- "$@") || exit 1 -eval set -- "$opts" -while true; do - case "$1" in - -h|--help) - printUsage; - exit 0;; - -u|--user) - user=$2; - shift; shift;; - --) - shift; - break;; - *) - echo "Unrecognized option $1."; - printUsage; - exit 1; - esac -done - -if [ "x$user" == "x" ]; then - echo "Required parameter user missing."; - printUsage; - exit 1; -fi - - -echo "Creating the Campcaster user database"; -echo "for user: $user."; -echo "" - - -#------------------------------------------------------------------------------- -# The details of installation -#------------------------------------------------------------------------------- -postgres_user=postgres - -ls_database=Campcaster-$user -ls_dbuser=test -ls_dbpassword=test -ls_dbserver=localhost - - -#------------------------------------------------------------------------------- -# Create the necessary database user and database itself -#------------------------------------------------------------------------------- -${scheduler_bindir}/createDatabase.sh --database=${ls_database} \ - --dbuser=${ls_dbuser} \ - --dbpassword=${ls_dbpassword} \ - --dbserver=${ls_dbserver} - - -#------------------------------------------------------------------------------- -# Create the ODBC data source and driver -#------------------------------------------------------------------------------- -${scheduler_bindir}/createOdbcDataSource.sh --database=${ls_database} \ - --dbserver=${ls_dbserver} - - -#------------------------------------------------------------------------------- -# Say goodbye -#------------------------------------------------------------------------------- -echo "Done." -