From 1a35e8d6b81f19150ccdf3d9b17d441eeb21f6f5 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 17 Jan 2007 16:07:56 +0000 Subject: [PATCH] possible fix for #2101 --- campcaster/bin/postInstallStation.sh | 59 ++++++++++++------- campcaster/bin/postUninstall.sh | 19 +++++- .../etc/debian/campcaster-station.postrm | 10 +++- .../etc/debian/campcaster-station.prerm | 12 +++- 4 files changed, 73 insertions(+), 27 deletions(-) diff --git a/campcaster/bin/postInstallStation.sh b/campcaster/bin/postInstallStation.sh index 26737b028..9023d6c63 100755 --- a/campcaster/bin/postInstallStation.sh +++ b/campcaster/bin/postInstallStation.sh @@ -282,6 +282,17 @@ ${install_bin}/createOdbcDataSource.sh --database=${ls_database} \ --dbserver=${ls_dbserver} +#------------------------------------------------------------------------------- +# 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 +fi + + #------------------------------------------------------------------------------- # Setup directory permissions #------------------------------------------------------------------------------- @@ -297,15 +308,17 @@ chmod g+sw $install_var_ls/archiveServer/var/access chmod g+sw $install_var_ls/archiveServer/var/trans chmod g+sw $install_var_ls/archiveServer/var/stor/buffer -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 +if [ "$storage_is_local" = "yes" ]; then + 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 + 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 +fi chgrp $apache_group $install_var_ls/htmlUI/var/templates_c chgrp $apache_group $install_var_ls/htmlUI/var/html/img @@ -379,12 +392,14 @@ ln -s $install_var_ls $www_root/campcaster #------------------------------------------------------------------------------- echo "Initializing database..."; -# create PHP-related database tables -cd $install_var_ls/storageServer/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 -cd - +if [ "$storage_is_local" = "yes" ]; then + # create PHP-related database tables + cd $install_var_ls/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 + cd - +fi # create PHP-related database tables cd $install_var_ls/archiveServer/var/install @@ -416,13 +431,15 @@ $install_bin/gst-register #------------------------------------------------------------------------------- # Generate a random password for the scheduler's access to the storage #------------------------------------------------------------------------------- -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/changeSchedulerPassword.php \ - ${SCHEDULER_STORAGE_PASS} - sed -i -e "s/ls_scheduler_storage_pass/${SCHEDULER_STORAGE_PASS}/" \ - $install_etc/campcaster-scheduler.xml +if [ "$storage_is_local" = "yes" ]; then + 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/changeSchedulerPassword.php \ + ${SCHEDULER_STORAGE_PASS} + sed -i -e "s/ls_scheduler_storage_pass/${SCHEDULER_STORAGE_PASS}/" \ + $install_etc/campcaster-scheduler.xml + fi fi diff --git a/campcaster/bin/postUninstall.sh b/campcaster/bin/postUninstall.sh index 506392de3..65deb9603 100755 --- a/campcaster/bin/postUninstall.sh +++ b/campcaster/bin/postUninstall.sh @@ -199,6 +199,17 @@ echo "Removing symlinks..."; rm -f $www_root/campcaster +#------------------------------------------------------------------------------- +# 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 +fi + + #------------------------------------------------------------------------------- # Delete data files #------------------------------------------------------------------------------- @@ -206,9 +217,11 @@ echo "Deleting data files..."; rm -rf $installdir/var/htmlUI/var/html/img/* rm -rf $installdir/var/htmlUI/var/templates_c/* -rm -rf $installdir/var/storageServer/var/stor/* -rm -rf $installdir/var/storageServer/var/access/* -rm -rf $installdir/var/storageServer/var/trans/* +if [ "$storage_is_local" = "yes" ]; then + rm -rf $installdir/var/storageServer/var/stor/* + rm -rf $installdir/var/storageServer/var/access/* + rm -rf $installdir/var/storageServer/var/trans/* +fi rm -rf $installdir/var/archiveServer/var/stor/* rm -rf $installdir/var/archiveServer/var/access/* rm -rf $installdir/var/archiveServer/var/trans/* diff --git a/campcaster/etc/debian/campcaster-station.postrm b/campcaster/etc/debian/campcaster-station.postrm index 2a180005a..698c20023 100644 --- a/campcaster/etc/debian/campcaster-station.postrm +++ b/campcaster/etc/debian/campcaster-station.postrm @@ -67,8 +67,16 @@ case "$1" in fi # remove generated files - rm -rf $installdir/var/Campcaster/storageServer/var/stor/* rm -rf $installdir/var/Campcaster/archiveServer/var/stor/* + + storagedir=$installdir/var/Campcaster/storageServer + storage_is_local=yes + if [ "`mount | grep -o \"on $storagedir \"`" = "on $storagedir " ]; then + storage_is_local=no + fi + if [ "$storage_is_local" = "yes" ]; then + rm -rf $storagedir/var/stor/* + fi ;; *) diff --git a/campcaster/etc/debian/campcaster-station.prerm b/campcaster/etc/debian/campcaster-station.prerm index 4a36f32c4..b31b9f626 100644 --- a/campcaster/etc/debian/campcaster-station.prerm +++ b/campcaster/etc/debian/campcaster-station.prerm @@ -76,10 +76,18 @@ case "$1" in rm -rf $installdir/etc/pear.conf rm -rf $installdir/var/Campcaster/htmlUI/var/html/img/* rm -rf $installdir/var/Campcaster/htmlUI/var/templates_c/* - rm -rf $installdir/var/Campcaster/storageServer/var/access/* - rm -rf $installdir/var/Campcaster/storageServer/var/trans/* rm -rf $installdir/var/Campcaster/archiveServer/var/access/* rm -rf $installdir/var/Campcaster/archiveServer/var/trans/* + + storagedir=$installdir/var/Campcaster/storageServer + storage_is_local=yes + if [ "`mount | grep -o \"on $storagedir \"`" = "on $storagedir " ]; then + storage_is_local=no + fi + if [ "$storage_is_local" = "yes" ]; then + rm -rf $storagedir/var/access/* + rm -rf $storagedir/var/trans/* + fi ;; failed-upgrade)