example config files: destroot or activate?
Bradley Giesbrecht
pixilla at macports.org
Tue Mar 6 10:23:21 PST 2012
On Mar 6, 2012, at 9:56 AM, Jeremy Lavergne wrote:
> We have several ports that are expected to "work out of the box" when installed. These packages require configuration files to be installed, so we first check that the user doesn't have one then install it.
>
> But what happens if the user modifies that file?
> Was this file recorded in the registry as part of the package if we did our conditional install in the destroot phase, wiping out their changes on deactivate or uninstall? If we're doing archives, will we need to worry then as well? Should destroot keep config files suffixed with ".example" or "-dist" and only in post-activate install a copy to make a ready-to-run port?
Yes, use post-activate to achieve what you want.
If the file is "installed" by MacPorts, meaning "port contents name" lists the file, then the file will be removed on deactivate.
Example:
$ port cat mpd
$ find $MP_SVNDPORTS -maxdepth 3 -name Portfile -exec echo {} \; -exec grep -A 5 -E "post-activate" {} \; | grep -B1 -v /Portfile
Regards,
Bradley Giesbrecht (pixilla)
More information about the macports-dev
mailing list