1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
#!/bin/bash -e
# Postrm script for PHPWiki.
# Written by Matthew Palmer <mpalmer@debian.org>
# Released under the GPL version 2.
# The following functions are copied from the webapps-common package
# written by Sean Finney and hosted on Alioth. The package is not yet
# in unstable, so we have to copy the required functions into here for
# now. Upstream source can be found at
# http://alioth.debian.org/projects/webapps-common/
# --- BEGIN webapps-common --
wc_httpd_apaches="apache apache-ssl apache-perl apache2"
wc_httpd_supported="$wc_httpd_apaches"
wc_httpd_installed(){
local httpds
if [ "$*" ]; then
httpds=$*
else
httpds=$wc_httpd_supported
fi
for f in $httpds; do
if test -x /usr/sbin/$f; then
echo $f
fi
done
}
wc_httpd_running(){
local httpds
if [ "$*" ]; then
httpds=$*
else
httpds=$wc_httpd_supported
fi
for f in $httpds; do
if pgrep -x $f >/dev/null; then
echo $f
fi
done
}
wc_httpd_invoke(){
local httpds cmd err
if [ ! "$1" ]; then
echo "i need at least a command!" 2>&1
return 1
fi
cmd="$1"
shift
if [ "$*" ]; then
httpds=$*
else
httpds=`wc_httpd_running`
fi
for f in $httpds; do
if [ -x /etc/init.d/$f ]; then
invoke-rc.d $f $cmd || return $?
fi
done
}
wc_httpd_apache_uninclude(){
local h incfile name httpds conflink
if [ ! "$1" ]; then
echo "i need at least a file!" 2>&1
return 1
fi
incfile="$1"
shift
if [ ! "$1" ]; then
echo "i also need a name!" 2>&1
return 1
fi
name="$1"
shift
if [ ! -e "$incfile" ]; then
echo "include file $incfile does not exist!" 2>&1
return 1
fi
if [ "$*" ]; then
httpds=$*
else
httpds=`wc_httpd_installed $wc_httpd_supported`
fi
for h in $httpds; do
conflink="/etc/$h/conf.d/${name}.conf"
if [ -L "$conflink" ]; then
rm -f "$conflink"
elif [ -e "$conflink" ]; then
echo "warning: $conflink exists but is not a link" >&2
fi
done
}
# --- END webapps-common --
# Now handle however we are called
if [ "$1" = "remove" ]; then
wc_httpd_apache_uninclude /etc/phpwiki/apache.conf phpwiki
wc_httpd_invoke reload
fi
if [ -f /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
fi
if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
. /usr/share/dbconfig-common/dpkg/postrm
dbc_go phpwiki $@
fi
#DEBHELPER#
if [ "$1" = "purge" ]; then
rm -f /etc/phpwiki/apache.conf
[ -x /usr/bin/ucf ] && /usr/bin/ucf --purge /etc/phpwiki/apache.conf
rm -f /etc/phpwiki/*.dpkg-*
rm -f /etc/phpwiki/*.ucf-*
rm -f /etc/phpwiki/debian-config.php
[ -x /usr/bin/ucf ] && /usr/bin/ucf --purge /etc/phpwiki/debian-config.php
rm -f /etc/phpwiki/index.php
[ -x /usr/bin/ucf ] && /usr/bin/ucf --purge /etc/phpwiki/index.php
rm -f /etc/phpwiki/config.ini
[ -x /usr/bin/ucf ] && /usr/bin/ucf --purge /etc/phpwiki/config.ini
rm -f /etc/phpwiki/*md5sum
if [ -d /etc/phpwiki ]; then
rmdir --ignore-fail-on-non-empty /etc/phpwiki
fi
if [ -d /var/lib/phpwiki ]; then
rmdir --ignore-fail-on-non-empty /var/lib/phpwiki
fi
fi
|