1

I've build a custom debian package with shuold overwrite configs of lightdm (autologin). My install script (debian/install) contains the following lines:

lightdm/* /etc/lightdm/lightdm.conf.d/

But I get the following error while installing my custom package:

dpkg: error processing /var/cache/apt/archives/AAA (--unpack):
trying to overwrite `/etc/lightdm/lightdm.conf.d/20-lubuntu.conf', which is also in package CCC
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
AAA E: Sub-process /usr/bin/dpkg returned an error code (1)

I know i can use the param --force-overwrite to install the package via dpkg. But I want to install it as dependency of an other package. So how can I allow my package to overwrite the config files of other packages?

I tried this but it wont work (debian/rules):

#!/usr/bin/make -f

%:
   dh $@

override_dh_command:
   dh_command -- --force-overwrite

override_dh_installdeb:
   dh_installdeb -- --force-overwrite

I got it. There is only on thing left. Now i can divert the original conf file. But the checksums of my DEBIAN/conffile is invalid so I deleted it. My debian/rules file:

overrider dh_installdeb:
    dh_installdeb
    rm debian/mypackage-name/DEBIAN/conffiles

I get the follwing warning:

Configuration file `/etc/lightdm/lightdm.conf.d/20-ubuntu.conf'
 ==> 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     : start a shell to examine the situation
 The default action is to keep your current version.
*** bash.bashrc (Y/I/N/O/D/Z) [default=N] ?

How can I remove the warning message?

This is the content of my debian/preinst file:

#!/bin/bash
dpkg-divert --add --package mypackage-name --rename --divert /etc/lightdm/lightdm.conf.d/20-lubuntu.conf.real /etc/lightdm/lightdm.conf.d/20-lubuntu.conf

Content of my debian/install file:

lightdm/* /etc/lightdm/lightdm.conf.d/

Content debian/rules:

#!/usr/bin/make -f

%:
    dh $@

override_dh_builddeb:
    dh_builddeb -- -z1

overrider dh_installdeb:
    dh_installdeb
    rm debian/mypackage-name/DEBIAN/conffiles

Thanks.

  • Anything that's in debian/rules is for building the package only, not for installing the package. – saiarcot895 Feb 15 '15 at 21:34
2

You don't. You divert them instead. For convenience, what I do is use a helper package like config-package-dev. With config-package-dev, you give your configuration files some specific names, and the installation will automatically do the required diversion.

For example, if your package is named foo-bar, then:

  1. Your debian/rules will have:

    %:
        dh $@ --with config-package
    
  2. Your configuration files end with .foo (for example, lightdm/20-lubuntu.conf.foo is created by your package building process) - the first word of your package name is used for this extension.
  3. You have config-package-dev in as a Build-Depends in your debian/control. For example:

    Build-Depends: debhelper (>= 7.0.0~), config-package-dev (>= 5.0)
    

    This means that config-package-dev needs to be installed before you try to build the package, but not for installing.

  4. In addition to the debian/install file, create a displace file listing each file which needs to be diverted. For example, it would contain:

    /etc/lightdm/lightdm.conf.d/20-lubuntu.conf.foo
    
| improve this answer | |
  • @IHopeLinux I think you missed the warning. – muru Feb 17 '15 at 21:19
  • Ive postet you the message in another answer – IHopeLinux Feb 17 '15 at 22:20
  • @IHopeLinux Edit it into the question, please. Also, does any of your scripts modify that file? Or has it been modified by other means? – muru Feb 17 '15 at 22:21
  • Its now in the first post. Sorry :) No i am only replacing the original file. But it wont wurk because the conffile-checksums are diferent. I read here i have to remove the DEBIAN/conffile, but now i get this error messige. – IHopeLinux Feb 18 '15 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.