Guillem Jover wrote:
> Just to clarify, for upgrades the original file is not directly deleted,
> but in shell examples that's the closest we can do to test the
> behaviour. Something like this roughly simulates what dpkg would do:
> 
>   $ s-s-d start dictd
>   $ cd /usr/sbin
>   $ cp /bin/ls dictd.new
>   $ ln dictd dictd.old
>   $ mv dictd.new dictd
>   $ rm dict.old
>   $ s-s-d stop dictd
> 
> and this should work on the shell and when done by dpkg.

If you actually try to make a package that uses -exec and restarts its
deamon in the postinst, it doesn't work. Example:

http://kitenet.net/~joey/tmp/dictd_1.10.11.dfsg-2_i386.deb

[EMAIL PROTECTED]:/home/joey/tmp>dpkg -i dictd_1.10.11.dfsg-2_i386.deb 
Selecting previously deselected package dictd.
(Reading database ... 207015 files and directories currently installed.)
Unpacking dictd (from dictd_1.10.11.dfsg-2_i386.deb) ...
usermod: no changes
Setting up dictd (1.10.11.dfsg-2) ...
Starting dictionary server: dictd.
Processing triggers for man-db ...
[EMAIL PROTECTED]:/home/joey/tmp>ps ax |grep dictd
27024 ?        Ss     0:00 dictd 1.10.11: 0/0
[EMAIL PROTECTED]:/home/joey/tmp>/etc/init.d/dictd restart
Restarting dictionary server: dictd.
[EMAIL PROTECTED]:/home/joey/tmp>ps ax |grep dictd
27046 ?        Ss     0:00 dictd 1.10.11: 0/0
[EMAIL PROTECTED]:/home/joey/tmp>/var/lib/dpkg/info/dictd.postinst configure 
1.10.11.dfsg-2
Restarting dictionary server: dictd.
[EMAIL PROTECTED]:/home/joey/tmp>ps ax |grep dictd
27131 ?        Ss     0:00 dictd 1.10.11: 0/0

All good so far, but now try reinstalling:

[EMAIL PROTECTED]:/home/joey/tmp>dpkg -i dictd_1.10.11.dfsg-2_i386.deb 
(Reading database ... 207054 files and directories currently installed.)
Preparing to replace dictd 1.10.11.dfsg-2 (using dictd_1.10.11.dfsg-2_i386.deb) 
...
usermod: no changes
Unpacking replacement dictd ...
Setting up dictd (1.10.11.dfsg-2) ...
Restarting dictionary server: dictd.
Processing triggers for man-db ...
[EMAIL PROTECTED]:/home/joey/tmp>ps ax |grep dictd
27131 ?        Ss     0:00 dictd 1.10.11: 0/0

pid did not change despite it "restarting" and now it's hosed:

[EMAIL PROTECTED]:/home/joey/tmp>/etc/init.d/dictd restart
Restarting dictionary server: dictd.
[EMAIL PROTECTED]:/home/joey/tmp>/etc/init.d/dictd stop   
Stopping dictionary server: dictd (not running).
[EMAIL PROTECTED]:/home/joey/tmp>ps ax |grep dictd
27131 ?        Ss     0:00 dictd 1.10.11: 0/0

The init script uses this to test if it's running, and after dpkg replaces
the binary it fails.

[EMAIL PROTECTED]:/home/joey/tmp>start-stop-daemon --start --quiet --pidfile 
/var/run/dictd.pid --exec /usr/sbin/dictd --test -v
Would start /usr/sbin/dictd .

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to