1

I'm building .deb packages for my internal tools. And would like to find a right way how to deal with configuration files on upgrade.

Currently when I install package-0.2.deb over package-0.1.deb, using apt install ./package-0.2.deb it replaces my existing configuration files in /etc/package/*

Instead, I would like to ask user what to do with old modified conf file (Replace, Keep, etc., like it works e.g. in nginx) by adding postinst or preinst control files. But can't find a common way how to do it other package maintainers.

Package dir structure /DEBIAN/control /etc/package/package.conf /usr/bin/package

  • https://www.debian.org/doc/manuals/maint-guide/dother.en.html#conffiles https://wiki.debian.org/DpkgConffileHandling https://raphaelhertzog.com/2010/09/21/debian-conffile-configuration-file-managed-by-dpkg/ – Zoredache May 15 '18 at 22:44
  • So, as I can see here https://www.debian.org/doc/manuals/maint-guide/dother.en.html#conffiles `dh_installdeb(1) automatically flags any files under the /etc directory as conffiles` But actually it doesn't.. I will try to specify it manually in conffiles. – Slava Kryvel May 16 '18 at 09:29
  • The fact that your `/DEBIAN` folder is in all caps tells me that you are probably manually building a binary package? That would mean that the standard tools that automatically do things like flag things don't happen. The more Debian way of doing thigns is to build from a source package. – Zoredache May 16 '18 at 16:43
  • @Zoredache Yes, I'm using dpkg-deb --build to build .deb package from my binaries and conf files. So, I should manualy create DEBIAN/conffiles in this case ? – Slava Kryvel May 16 '18 at 21:46

1 Answers1

0

FYI To be asked by installer what to do with old configuration files, those files must be listed in /DEBIAN/conffiles file