On Mon, 18 Dec 2006, Steve McIntyre wrote: > >Only enabling it using dpkg-reconfigure makes changes persistent accross > >upgrades. > > Pardon me for being dense, but I don't see a way in the postinst of > knowing whether I'm being called via dpkg-reconfigure. Any clues?
I don't think your postint needs to care. As I understand the debconf-devel(7) manual page (section 'Config file handling') you need to find out the current status of the system in your .config file, then use db_set to inform debconf about that status, so you can use it in your postinst script. In fact you already appear to be doing at least some db_sets in your .config maintainer script, only CVS_ENAB_PSERV somehow needs to get properly set based on the current inetd.conf. Something like this fixes the enable/disable problem: --- cvs.config.orig 2006-12-18 04:13:03.766969143 +0100 +++ /var/lib/dpkg/info/cvs.config 2006-12-18 04:13:15.000000000 +0100 @@ -49,13 +49,10 @@ if [ "$CVS_PSERV_RESPAWN" ]; then db_set cvs/pserver_spawnlimit "$CVS_PSERV_RESPAWN" || true fi - if [ "$CVS_ENAB_PSERV" ]; then - CVS_ENAB_PSERV=`echo "$ENAB_PSERV" | tr A-Z a-z` - if [ "$CVS_ENAB_PSERV" = "yes" ]; then - db_set cvs/pserver true || true - else - db_set cvs/pserver false || true - fi + if grep -q '^cvspserver' /etc/inetd.conf; then + db_set cvs/pserver true || true + else + db_set cvs/pserver false || true fi if [ "$OTHER_ROTKEEP" ]; then db_set cvs/rotatekeep "$OTHER_ROTKEEP" || true [It seems update-inetd has no method to query the status of a service. Eww.] However, this does not fix all of the cvs package's problems. For instance the spawn limit is not read back either, resulting again in manual config changes being lost on upgrades: | [EMAIL PROTECTED]:~$ grep pser /etc/inetd.conf | cvspserver stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/cvs-pserver | [EMAIL PROTECTED]:~$ sudo sed -i -e 's/400/200/' /etc/inetd.conf | [EMAIL PROTECTED]:~$ grep pser /etc/inetd.conf | cvspserver stream tcp nowait.200 root /usr/sbin/tcpd /usr/sbin/cvs-pserver | [EMAIL PROTECTED]:~$ sudo dpkg -i cvs_1.12.13-5_i386.deb | (Reading database ... 123483 files and directories currently installed.) | Preparing to replace cvs 1:1.12.13-5 (using cvs_1.12.13-5_i386.deb) ... | Unpacking replacement cvs ... | Setting up cvs (1.12.13-5) ... | | [EMAIL PROTECTED]:~$ grep pser /etc/inetd.conf | cvspserver stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/cvs-pserver ^^^ Another, related problem is the following: | [EMAIL PROTECTED]:~$ grep pser /etc/inetd.conf | cvspserver stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/cvs-pserver | [EMAIL PROTECTED]:~$ sudo sed -i -e 's/^cvspserver/# cvspserver/' /etc/inetd.conf | [EMAIL PROTECTED]:~$ grep pser /etc/inetd.conf | # cvspserver stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/cvs-pserver | intrepid:~# DEBIAN_FRONTEND=readline dpkg-reconfigure cvs [..] | Should the CVS pserver be enabled? yes [..] | [EMAIL PROTECTED]:~$ grep pser /etc/inetd.conf | # cvspserver stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/cvs-pserver That is, enabling pserver, when it is commented out with just a '#' does not work. The reason for this is that update-inetd only touches lines starting with '#<off># ' or the service port. It ignored lines that are commented out: | intrepid:~# grep pser /etc/inetd.conf | # cvspserver stream tcp nowait.400 root /usr/sbin/tcpd | # /usr/sbin/cvs-pserver | intrepid:~# /usr/sbin/update-inetd --multi --remove "cvspserver.*" | intrepid:~# grep pser /etc/inetd.conf | # cvspserver stream tcp nowait.400 root /usr/sbin/tcpd | # /usr/sbin/cvs-pserver | intrepid:~# /usr/sbin/update-inetd --group OTHER --add "cvspserver stream tcp nowait.9999999 root /usr/sbin/tcpd /usr/sbin/cvs-pserver" | intrepid:~# grep pser /etc/inetd.conf | # cvspserver stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/cvs-pserver I realize that fixing all this in time for etch will be hard. It would be nice if the enable/disable change on upgrades could be fixed. The other items probably are better left for later. If you agree please clone the bug and handle them sepeartly. Thanks, Peter -- | .''`. ** Debian GNU/Linux ** Peter Palfrader | : :' : The universal http://www.palfrader.org/ | `. `' Operating System | `- http://www.debian.org/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]