This is the mail archive of the 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]

Setup of default configuration files

Hi All,

Christopher and I had a little conversation at the beginning of
December.  It occured to me/us that a lot of cygwin packages
have postinstall scripts which just copy default versions of
configuration files into the correct location if they don't
already exist.

It was thought that this could be simplified into just one
postinstallation script.  Basically, the script would, when a
new file has been placed under a particular directory
(/etc/defaults/) it would be copied (/etc/defaults/ becomming
the equivalent of /) if a file of the same name didn't already

This has (I think) two advantages
1) not everyone has to maintain such a post installation script and
2) there's no excuse not to make use of it and config files
   wouldn't be deleted upon uninstall.

Anyway, the script...


cd /etc/defaults
for f in `find . -type f`; do
        fDest=`echo $f | sed 's/^\.//g'`
        if [ ! -f $fDest ]; then
                echo Using the default version of $fDest
                cp $f $fDest
                echo $fDest is already in existance, not overwriting.

Packages can be found... (note that it needs renumbering,
but should give you some idea of the functionality)

(this should be added to the 'how to create a package' instructions, or
something like?)

sdesc: "Conditionally move default files to proper location"
category: _PostInstallLast
requires: ash findutils fileutils sed sh-utils
autodep: etc/defaults/.*
incver_ifdep: yes


Also, I've re-done base-files using this mechanism as
a demonstration...

Thanks for reading so much, hope to hear some
feedback :)


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