This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cygport: patches welcome?


I like cygport and would like to make a couple of improvements to it:

(1) Comprehensive man page, describing the available facilities for writing
cygport scripts.  As it is now, I have to page through
/usr/lib/cygport/bin/* and even /usr/bin/cygport itself, to see what the
available functions are and exactly how they work.  Some of the functions
are described in /usr/share/doc/cygport/README, but not all and not
completely.  I want to add a complete description of them to the man page.

(2) Smarter update of config files.  In cygport's make_etc_defaults
function, we have a golden opportunity to fix a problem that's persisted for
a long time in Cygwin:  when a package's default config file (typically in
/etc) is updated, we don't currently have a standard way of automatically
and safely installing the new version, because just copying it into /etc
would destroy any of the user's existing customizations.  Our current best
practice is to put

[ -f /etc/file ] || cp /etc/defaults/etc/file /etc

in a postinstall script.  If the package has ever been installed before,
even if the user has never touched it, the new config file won't be copied
in; we have to alert users to copy them in manually.  Debian has a smarter
way of handling this problem:  in pseudocode, it looks something like:

  if md5hash(/etc/file) == stored md5hash(/etc/defaults/etc/file)
  then
    # user hasn't changed their config; install the new one in its place
    cp /etc/defaults/etc/file /etc
  else
    # user changed their config; install the new one alongside it
    cp /etc/defaults/etc/file /etc/file.conf-new
  fi
  store md5hash(/etc/defaults/etc/file)

With this method, users still have to manually merge in any customizations
they've made, but at least if they haven't customized the config file, the
new one will be automatically installed in its place.

make_etc_defaults would be an excellent place to start implementing this,
especially as more packagers move to cygport.  The packager could still call
make_etc_defaults as before, and cygport would insert code for the above
algorithm.

Question for Yaakov:  If I submit patches for these things, are you at least
potentially interested in merging them into cygport?

Thanks,
Andrew.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]