On Tue, Feb 26, 2019 at 11:57:00PM +0100, Dominik George wrote: > How about the attached approach? > > It uses dpkg-maintscript-helper in openssh-client to remove the > conffile. dpkg-maintscript=helper does all the magic to determine > whether the file was changed by the user. Here, we use the fact that in > preinst, it only moves the file to a backup location, and this location > is different when the file is user-modified. > > In postinst of openssh-server, we then check for the backup file and > move it back in place if it exists. This… > > …fixes the obsolete conffile, > …avoids an annoying question on upgrade whether to overwrite the file, > is it was user-modified, > …still keeps user modifications intact. > > I tested the following: [...]
Ah, clever. Thanks! I also tested this, including upgrades through intermediate versions, and it works correctly in every scenario I can come up with. Normally the openssh-server postinst code in fact does nothing because apt currently seems to unpack the new openssh-server before the new openssh-client and so by the time dpkg-maintscript-helper runs from openssh-client.preinst the file has already been taken over by openssh-server; but even if I perform the unpack and configure operations manually using dpkg such that openssh-client.preinst runs before the new openssh-server is unpacked, your code still works. I fleshed out the comment a bit, and committed this in your name. I'll upload it soon along with other pending changes. -- Colin Watson [cjwat...@debian.org]