Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Prevent creation of conffiles

I'm trying to build a package which has some files under /etc that are not configuration. They are included in the conffiles automatically even if I create an empty package.conffiles in the debian directory.

How can I stop dh_installdeb from doing that?

like image 605
viraptor Avatar asked Dec 22 '22 00:12


2 Answers

I’m not sure I understand rafl’s answer, but dh_installdeb as of debhelper=9.20120115ubuntu3 adds everything below /etc to conffiles nearly unconditionally: debian/conffiles adds conffiles but does not override them.

It’s possible to override manually in debian/rules. For example, in order to prevent any files from being registered as conffiles:

    find ${CURDIR}/debian/*/DEBIAN -name conffiles -delete

(of course, indentation must be hard tab)

like image 50
Vasiliy Faronov Avatar answered Jan 14 '23 01:01

Vasiliy Faronov

It's possible to define a upgrade rule at preinst script in debian/<package-name>.preinst using dpkg-maintscript-helper.

# preinst script for <package-name>

set -e

case "$1" in
      if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then
        dpkg-maintscript-helper rm_conffile /etc/foo/conf.d/bar <Previous package version> -- "$@"


        echo "preinst called with unknown argument \`$1'" >&2
        exit 1

exit 0

More info: The right way to remove an obsolete conffile in a Debian package

like image 21
Diego Lopez Avatar answered Jan 14 '23 02:01

Diego Lopez