5. Configuration file handling (from old Packaging Manual)
dpkg
can do a certain amount of automatic handling of package configuration files.
Whether this mechanism is appropriate depends on a number of factors, but basically there are two approaches to any particular configuration file.
The easy method is to ship a best-effort configuration in the package, and use dpkg
’s conffile mechanism to handle updates. If the user is unlikely to want to edit the file, but you need them to be able to without losing their changes, and a new package with a changed version of the file is only released infrequently, this is a good approach.
The hard method is to build the configuration file from scratch in the postinst
script, and to take the responsibility for fixing any mistakes made in earlier versions of the package automatically. This will be appropriate if the file is likely to need to be different on each system.