best practice for upgrading config files?

Andrew Schulman
Tue May 9 19:30:00 GMT 2006

I'm packaging a new release of lftp.  The default config file
(/etc/lftp.conf) is slightly different from the one in the previous release.
This raises a problem:  how should I determine whether to replace the old
config file?  There are at least three approaches, in increasing order of

(1) Copy the new default config in only if none already exists:

[ -e /etc/lftp.conf ] || cp /etc/defaults/etc/lftp.conf /etc

I've used this approach in my other packages, e.g. orpie.  Gerrit, I think
it was, told me it was a bug, but looking around I see that some other
packages also use it.  It's simple, but anyone who's ever installed lftp
before won't get the new default config file. 

(2) Ask the user what they want to do, if /etc/lftp.conf already exists.  It
seems to me that this could get to be quite elaborate; if I'm going to ask
the user what they want to do, then I need to offer them some good
alternatives, e.g. look at the diffs.  If this is the preferred method for
Cygwin, then I shouldn't be writing it ad hoc.  We should develop a standard
postinstall script or shell function to handle it.  

(3) Compute a checksum of the current /etc/lftp.conf, and compare it to the
checksum of the old default.  If they're the same, then the user hasn't
touched the old default so copy the new default in.  If they're different,
then prompt the user as in (2).  So we need to store checksums of default
config files somewhere.  This is Debian's method.  Again if this is the
preferred method, then someone should develop a standard method to handle

Is one of these approaches, or some other one, preferred for Cygwin?  Or is
it up to my discretion?


More information about the Cygwin-apps mailing list