Package: dpkg
Version: 1.13.18

I'm trying to override a config file provided by nagios-plugins with a
custom version.  As such I have this in my preinst:

if [ "$1" = "install" ]; then
  dpkg-divert --package nagios-plugins-custom --add --rename \
       --divert /etc/nagios/nrpe.cfg.divert.custom /etc/nagios/nrpe.cfg
fi

and in the postrm:

if [ "$1" = "remove" ]; then
  dpkg-divert --package nagios-plugins-custom --remove --rename \
        --divert /etc/nagios/nrpe.cfg.divert.custom /etc/nagios/nrpe.cfg
fi

However if I try and install this I get this:

dpkg -i nagios-plugins-custom_1.0_i386.deb 
Selecting previously deselected package nagios-plugins-custom.
(Reading database ... 131893 files and directories currently installed.)
Unpacking nagios-plugins-custom (from
nagios-plugins-custom_1.0_i386.deb) ..
.
Adding `diversion of /etc/nagios/nrpe.cfg to
/etc/nagios/nrpe.cfg.divert.custom by 
nagios-plugins-custom'
[[ looks good ]]
Setting up nagios-plugins-custom (1.0) ...

[[ Not convinced about this - I have diverted it after all. ]]
Configuration file `/etc/nagios/nrpe.cfg'
 ==> Deleted (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
   Y or I  : install the package maintainer's version
   N or O  : keep your currently-installed version
     D     : show the differences between the versions
     Z     : background this process to examine the situation
The default action is to keep your current version.
*** nrpe.cfg (Y/I/N/O/D/Z) [default=N] ? y 
Installing new version of config file /etc/nagios/nrpe.cfg ...

The right thing has happened, but I don't think the user should have
been asked the question - this is the first version since the divert.

The thing that's really going wrong is the remove:

dpkg --purge nagios-plugins-custom
(Reading database ... 131899 files and directories currently installed.)
Removing nagios-plugins-custom ...
Removing `diversion of /etc/nagios/nrpe.cfg to
/etc/nagios/nrpe.cfg.divert.custom by nagios-plugins-custom'
dpkg-divert: rename involves overwriting `/etc/nagios/nrpe.cfg' with
  different file `/etc/nagios/nrpe.cfg.divert.custom', not allowed
Restarting nagios-nrpe: nagios-nrpe.
Purging configuration files for nagios-plugins-custom ...
  
FWIW I also get all these issues on sarge (and an additional one which
seems to be #312931/140222/351361):

dpkg -i nagios-plugins-custom_1.0_i386.deb 
Selecting previously deselected package nagios-plugins-custom.
(Reading database ... 12234 files and directories currently installed.)
Unpacking nagios-plugins-custom (from
nagios-plugins-custom_1.0_i386.deb) ...
Adding `diversion of /etc/nagios/nrpe.cfg to
/etc/nagios/nrpe.cfg.divert.custom by nagios-plugins-custom'
Setting up nagios-plugins-custom (1.0) ...

Configuration file `/etc/nagios/nrpe.cfg'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
  What would you like to do about it ?  Your options are:
   Y or I  : install the package maintainer's version
   N or O  : keep your currently-installed version
     D     : show the differences between the versions
     Z     : background this process to examine the situation
 The default action is to keep your current version.
*** nrpe.cfg (Y/I/N/O/D/Z) [default=N] ? y
dpkg: nagios-plugins-custom: warning - failed to link `/etc/nagios/nrpe.cfg' to
`/etc/nagios/nrpe.cfg.dpkg-old': No such file or directory
Installing new version of config file /etc/nagios/nrpe.cfg ...


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to