From: Charles W. <cwi...@us...> - 2012-09-09 19:36:44
|
On 9/9/2012 7:42 AM, Keith Marshall wrote: > 3) Distribute the default configuration with an alternative name, (as in > mingw-get's defaults.xml --> profile.xml implementation of (2)), and use > a mingw-get post-install hook to copy the distributed file to the active > file, only if no active file already exists. this is how cygwin handles things, and I hope to eventually provide support in mgwport similarly, using Keith's lua scripting capabilities in mingw-get. Here's how cygwin/cygport would do it: the tarball contains etc/defaults/usr/libexec/conemu/conemu.xml etc/postinstall/conemu.sh etc/preremove/conemu.sh setup.exe runs the postinstall script, which does the following (pseudocode): if /usr/libexec/conemu/conemu.xml exists do nothing else cp etc/defaults/usr/libexec/conemu/conemu.xml \ /usr/libexec/conemu/ The pre-remove (which would get executed, say, before an upgrade is performed) is a bit more complicated: compare /usr/libexec/conemu/conemu.xml and /etc/defaults/usr/libexec/conemu/conemu.xml if they differ do nothing -- leave /usr/libexec/conemu/conemu.xml alone else rm /usr/libexec/conemu/conemu.xml ## in both cases, "package removal" will take care of removing ## /etc/defaults/usr/libexec/conemu/conemu.xml This way, the user customizes the file in /etc/, and those customizations are retained across upgrades. But if the user does NOT customize, then each new upgrade will install the latest default settings into /etc. cygwin setup doesn't yet have the capability of warning the user that defaults may have changed (e.g. like an rpmnew/rpmsave capability). The extension to mingw-get's lua facilities is obvious: The tarball contains: etc/defaults/usr/libexec/conemu/conemu.xml which gets installed into $MINGWROOT/etc/defaults/usr/libexec/conemu/conemu.xml while the analogous scripts to cygwin/cygports: etc/postinstall/conemu.sh etc/preremove/conemu.sh would be lua fragments embedded in the mingw-get conemu.xml package description file (not to be confused with the conemu.xml configuration file). The tricky bit is to convince mgwport to do all the grunt work for you, like cygport's "make_etc_defaults" subcommand, to produce the appropriate lua fragments -- or even auto-regenerated the full mingw-get xml file for you. However, you can hand-roll your own manually, taking advantage of all of these mingw-get facilities, if you wanted to package it that way, today. -- Chuck |