Best practices for config files

Ryan Schmidt ryandesign at macports.org
Mon Feb 23 17:29:40 PST 2009


On Feb 23, 2009, at 04:03, Scott Haneda wrote:

> What are the best practices for providing config files with ports?

Provide sample config files. For example, if the software looks for a  
config file at ${prefix}/etc/${name}/${name}.conf, then you should  
install a file ${prefix}/etc/${name}/${name}.conf.sample and output a  
message explaining that you did this and advise the user to copy that  
file to ${prefix}/etc/${name}/${name}.conf and configure it as desired.

You can be more clever and only output this message if the user has  
not already done so.

You can see the whois port for an example. Look in the post-destroot  
and post-activate phases.


> I am working with a friend to make an all in one ISP solution,  
> email, dns, database, webmail, etc etc.  Sort of a cpanel done  
> right on the Mac.
>
> Let'stake Roundcube for example, there is not a port that I can  
> see.  This is a basic install, it is just a download, uncompress,  
> and move to location.
>
> That would cover the default port.  However, I want to make a  
> custom config file, that is a little more tailored to the ISP  
> solution port we are working on.
>
> Do you use a variant for this, port install roundcube +custom- 
> config or similar?

Please do not create variants for alternate config files. Variants  
should be created sparingly in portfiles if at all. (A valid reason  
for creating a variant would for example be to add an esoteric  
feature that requires a dozen dependent libraries that take two hours  
to build.)

Instead, I suggest you install multiple sample config files and allow  
the user to choose which of them to copy into place.



More information about the macports-users mailing list