Editing existing user-customized files

Joshua Root jmr at macports.org
Thu Dec 23 16:54:25 PST 2010


On 2010-12-24 11:37 , Ryan Stonecipher wrote:
> In the mpd portfile I provided a default configuration file, mpd.conf,
> in r47239.
> This configuration file is only destrooted if no file
> ${prefix}/etc/mpd.conf exists.
> My intent was to not replace potentially-customized configuration
> files with the default at each version/revision bump.

Changing what you install into the destroot based on what's active in
the prefix is not right. See
<http://trac.macports.org/wiki/PortfileRecipes#configfiles>.

> I would like to add an else statement so that upon detection of an
> existing mpd.conf:
> 1) the existing ${prefix}/etc/mpd.conf is copied to ${destroot}${prefix}/etc/
> 2) all lines containing "error_file" are either commented out or removed
> Could this be done within the post-destroot phase?

It would have to be in post-activate. You could reinplace whatever in
the file there.

Fiddling with users' config files isn't something we normally do though.
It's kind of lame if a program actually stops working when there's a
deprecated/removed option in its config file rather than just ignoring it.

- Josh


More information about the macports-dev mailing list