X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostrm;h=3324e2aec0b249d87f8c1625ab508c6e0e308440;hb=5a453dc81e5301d37919a4d4394666a18d4c26ad;hp=38144045edfef641fa149a41bfd4831fd258f495;hpb=d0545bc48a700b22c3def9c648d97c6b80398cfe;p=apache2-cn.git diff --git a/debian/postrm b/debian/postrm index 3814404..3324e2a 100755 --- a/debian/postrm +++ b/debian/postrm @@ -2,9 +2,6 @@ set -e -# Debconf -. /usr/share/debconf/confmodule - # Include CARNet functions. . /usr/share/carnet-tools/functions.sh @@ -16,75 +13,71 @@ sitefiles= case "$1" in - purge) - # Get CARNet config files in /etc/apache2/sites-available directory. - if [ -d "${sitesdir}" ] && [ -n "$(ls ${sitesdir}/)" ]; then - - for file in ${sitesdir}/*; do - if [ -f "$file" ]; then - if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then - site=`echo "$file" | sed 's/^\/.*\///'` - sitefiles="$sitefiles $site" - fi + purge) + # Get CARNet config files in /etc/apache2/sites-available directory. + if [ -d "${sitesdir}" ] && [ -n "$(ls ${sitesdir}/)" ]; then + + for file in ${sitesdir}/*; do + if [ -f "$file" ]; then + if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then + site=`echo "$file" | sed 's/^\/.*\///'` + sitefiles="$sitefiles $site" + fi + fi + done + fi + + # Remove our vhosts. + if [ -n "$sitefiles" ]; then + for site in $sitefiles; do + + if [ -e "$sitesdir/$site" ]; then + + cp_echo "CN: Removing $site site configuration file." + rm -f $sitesdir/$site + fi + done + fi + + # Remove default DocumentRoot if there's only a one line index.html there + docroots="/var/www/$HOST /var/www/www.$DOMAIN" + + if [ -d "/var/www" ]; then + + for docroot in $docroots; do + + if [ -d $docroot ]; then + if [ "x$(echo ${docroot}/*)" = "x${docroot}/index.html" ]; then + if [ "$(wc -l ${docroot}/index.html | awk '{print $1}')" -eq 1 ]; then + + cp_echo "CN: Removing document root directory ${docroot}." + rm -f $docroot/index.html + rmdir $docroot || true fi - done + fi fi - - # Remove our vhosts. - if [ -n "$sitefiles" ]; then - for site in $sitefiles; do - - if [ -e "$sitesdir/$site" ]; then - - cp_echo "CN: Removing $site site configuration file." - rm -f $sitesdir/$site - fi - done - fi - - # Remove default DocumentRoot if there's only a one line index.html there - docroots="/var/www/$HOST /var/www/www.$DOMAIN" - - if [ -d "/var/www" ]; then - - for docroot in $docroots; do - - if [ -d $docroot ]; then - if [ "x$(echo ${docroot}/*)" = "x${docroot}/index.html" ]; then - if [ "$(wc -l ${docroot}/index.html | awk '{print $1}')" -eq 1 ]; then - - cp_echo "CN: Removing document root directory ${docroot}." - rm -f $docroot/index.html - rmdir $docroot || true - fi - fi - fi - done - fi - - # Remove CARNet specific configuration. - if [ -d "${CONFDIR}/conf.d" ] && [ -n "$(ls ${CONFDIR}/conf.d/)" ]; then - cp_echo "CN: Disabling CARNet specific configuration." - for file in ${CONFDIR}/conf.d/*; do - if [ -f "$file" ]; then - if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then - rm -f $file - fi - fi - done - fi - - # Debconf purge - db_purge - - # Mail root - cp_mail "apache2-cn" - ;; - *) - ;; -esac + done + fi + + # Remove CARNet specific configuration. + if [ -d "${CONFDIR}/conf.d" ] && [ -n "$(ls ${CONFDIR}/conf.d/)" ]; then + cp_echo "CN: Disabling CARNet specific configuration." + for file in ${CONFDIR}/conf.d/*; do + if [ -f "$file" ]; then + if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then + rm -f $file + fi + fi + done + fi + # Mail root + cp_mail "apache2-cn" + ;; + *) + ;; +esac -db_stop +#DEBHELPER# exit 0