110 lines
3.1 KiB
Bash
110 lines
3.1 KiB
Bash
#!/bin/sh
|
|
# prerm script for campcaster
|
|
#
|
|
# see: dh_installdeb(1)
|
|
|
|
set -e
|
|
|
|
# summary of how this script can be called:
|
|
# * <prerm> `remove'
|
|
# * <old-prerm> `upgrade' <new-version>
|
|
# * <new-prerm> `failed-upgrade' <old-version>
|
|
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
|
|
# * <deconfigured's-prerm> `deconfigure' `in-favour'
|
|
# <package-being-installed> <version> `removing'
|
|
# <conflicting-package> <version>
|
|
# for details, see http://www.debian.org/doc/debian-policy/ or
|
|
# the debian-policy package
|
|
|
|
|
|
installdir=/
|
|
vardir=/var/lib/campcaster/
|
|
ls_database=Campcaster
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# 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
|
|
return 0;
|
|
else
|
|
return 1;
|
|
fi
|
|
}
|
|
|
|
|
|
if [ -d /etc/postgresql/8.1 ]; then
|
|
postgresql_dir=/etc/postgresql/8.1/main
|
|
postgresql_init_script=/etc/init.d/postgresql-8.1
|
|
elif [ -d /etc/postgresql/8.2 ]; then
|
|
postgresql_dir=/etc/postgresql/8.2/main
|
|
postgresql_init_script=/etc/init.d/postgresql-8.2
|
|
elif [ -d /etc/postgresql/8.3 ]; then
|
|
postgresql_dir=/etc/postgresql/8.3/main
|
|
postgresql_init_script=/etc/init.d/postgresql-8.3
|
|
elif [ -d /etc/postgresql/8.4 ]; then
|
|
postgresql_dir=/etc/postgresql/8.4/main
|
|
postgresql_init_script=/etc/init.d/postgresql-8.4
|
|
else
|
|
echo "no postgresql 8.1, 8.2, 8.3 or 8.4 found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
case "$1" in
|
|
remove|deconfigure)
|
|
cd /usr/share/campcaster/www/htmlUI/var/install/
|
|
php -q uninstall.php
|
|
cd /usr/share/campcaster/www/storageServer/var/install/
|
|
php -q uninstall.php
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
|
|
case "$1" in
|
|
remove|upgrade|deconfigure)
|
|
mkdir -p $vardir
|
|
# unmount the NFS share, if we have a 2-computer setup
|
|
storagedir=$vardir/storageServer
|
|
if [ "`mount | grep -o \"on $storagedir \"`" = "on $storagedir " ]; then
|
|
echo "Unmounting the remote storage..."
|
|
umount $storagedir
|
|
touch $vardir/storageServer.wasMounted
|
|
fi
|
|
|
|
## remove the ODBC data source and driver
|
|
check_exe "odbcinst" || odbcinst_found=no
|
|
|
|
if [ "x$odbcinst_found" != "xno" ] ; then
|
|
odbcinst -u -s -l -n $ls_database
|
|
odbcinst -u -d -n PostgreSQL_Campcaster
|
|
fi
|
|
|
|
rm -f /etc/apache/conf.d/90_php_campcaster.conf
|
|
rm -f /etc/apache2/conf.d/90_php_campcaster.conf
|
|
rm -f /etc/apache2/conf/modules.d/90_php_campcaster.conf
|
|
rm -f /etc/httpd/conf.d/90_php_campcaster.conf
|
|
|
|
##rm -rf $installdir/etc/pear.conf
|
|
|
|
;;
|
|
|
|
failed-upgrade)
|
|
;;
|
|
|
|
*)
|
|
echo "prerm called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# dh_installdeb will replace this with shell code automatically
|
|
# generated by other debhelper scripts.
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|