On Friday 17 Sep 2010 11:17:07 Tim Cutts wrote: > On 17 Sep 2010, at 10:59 am, Davide Brini wrote: > > Well, if my custom file is in place before the package is installed, > > could it be overwritten with the default one by the package > > installation? (I haven't tried to be honest) > > That depends, I suspect, on how you invoke your package manager, and what > its default behaviour is. For Debian-derived distros, invoking aptitude > with the following option forces it to preserve existing config files, if > they're different from the package's own version. > > -o Dpkg::Options::="--force-confold" > > On Debian systems, I use a script I called "niagi" (non-interactive apt-get > install), which does this and a few other things to make it work smoothly > with cfengine 2, but I imagine it would also work with cfengine 3.: > > #!/bin/bash > > DEBIAN_FRONTEND=noninteractive \ > /usr/bin/aptitude -R -y \ > -o Dpkg::Options::="--force-confdef" \ > -o Dpkg::Options::="--force-confold" \ > install ${*} >/dev/null > > The result of this is that aptitude never asks any questions. If the conf > files are already present, they are preserved (dpkg will install newer > versions as conf-file.dpkg-new instead, so you can examine whether any > changes might be needed to your policy files later), and if the conf file > is not present, it will simply choose all of the package's defaults (or > whatever your debconf settings are, although we don't tend to use those > because cfengine doesn't have, as far as I know, a built-in method for > manipulating debconf settings - they're somewhat redundant anyway when > you're controlling the config files directly)
This is a clever solution, thanks for sharing. Since I think I understand the different views about cfengine's expected behavior for package promises, I have opened a feature request for adding an option to have the exit status count towards declaring the promise kept or not. That way users could chose to have either behaviors, which I think would accommodate fans of both camps. -- D. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine