This one time, at band camp, Martin Lohmeier said:
> Stephen Gran wrote:
> 
> | -------------------------------------------------------
> | @@ -124,9 +124,7 @@
> |      done
> |
> |      db_get phpldapadmin/restart-webserver || true
> | -    if [ "$RET" = "true" ]; then
> | +    restart="$RET"
> | +    db_stop || true
> | +    if [ "$restart" = "true" ]; then
> |          for webserver in $restart; do
> |              webserver=${webserver%,}
> |              if [ -x /usr/sbin/invoke-rc.d ]; then
> | ---------------------------------------------------------
> 
> Hi Stephen,
> 
> I almost got it working. It is restarted on install, but not on purge /
> remove. Same code is used in postrm...thats why it's realy strange.
> 
> I send you a patch when it's compleately working.
> 
> by, Martin

A quick look makes it look like it is the same issue:
$webserver restart is called before db_stop.  

Also, some reorganization is probably necessary in postrm, I see.
After remove (but not purge) the package contents will be gone, although
files in /etc will still be there.  The best way to handle this, IMHO,
is to remove the symlink from $webserver/conf.d -> /etc/phpladapadmin
and restart the webserver on remove, and remove the other /etc/ files
on purge.

Not positive, but that gives the principle of least surprise, I think.

So, something like (completely untested - please somebody test this to
make sure it actually works before going along :)  :

#! /bin/sh

set -e

case "$1" in
  remove)

    . /usr/share/debconf/confmodule
    db_version 2.0 || [ $? -lt 30 ]

    rm -f /usr/share/phpldapadmin/config.php

    db_get phpldapadmin/reconfigure-webserver
    webservers="$RET"
    restart=""

    for webserver in $webservers; do
        webserver=${webserver%,}

        case "$webserver" in
            apache|apache-perl|apache-ssl|apache2)
                rm -f /etc/$webserver/conf.d/phpldapadmin
                test -x /usr/sbin/$webserver || continue
                restart="$restart $webserver"
                ;;
             *)
                ;;
        esac
    done

    db_get phpldapadmin/restart-webserver
    res="$RET"
    db_stop || true
    if [ "$res" = "true" ]; then
        for webserver in $restart; do
            webserver=${webserver%,}
            if [ -x /usr/sbin/invoke-rc.d ]; then
                invoke-rc.d $webserver restart
            else
                /etc/init.d/$webserver restart
            fi
        done
    fi
    ;;
  purge)
    rm -f /etc/phpldapadmin/config.php
    rmdir --ignore-fail-on-non-empty /etc/phpldapadmin || true
    ;;
esac

#DEBHELPER#

-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        [EMAIL PROTECTED] |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

Attachment: pgpAVuIIeoebV.pgp
Description: PGP signature

Reply via email to