Installing 'config' file with port

Torfinn Ingolfsen tingox at
Mon Mar 2 09:58:59 PST 2009


On Mon, Mar 2, 2009 at 3:02 PM, Jerry <gesbbb at> wrote:
> I am creating a port that will install a 'config' file in the
> "/usr/local/etc" directory. Reading through the 'Porters Handbook", I
> cam across this example.
> post-install:
>    @if [ ! -f ${PREFIX}/etc/orbit.conf ]; then \
>        ${CP} -p ${PREFIX}/etc/orbit.conf.sample ${PREFIX}/etc/orbit.conf ; \
>    fi

This is done so that the config file is not overwritten if it is
already there (think port upgrade). If the config file exists already,
just copy the *.conf.sample file without renaming it.

> First, when I write the 'config' file, do I place it under the ports
> 'files' directory and give it a ".in".

Yes, the files directory is a good place.
Why not simply call it 'application.conf' (if that is the name it will
have) or 'application.conf.sample'?

> Second, what do I have to do to get the file installed in the config
> directory?

copy it in the post-install target?

> The program does not come with a config file by default. If that should
> change, how would I go about using it instead of the one I created?

Change the port when you know the location and name of the file, perhaps?
However, if you think that distributing a config file with this
application wold be useful, perhaps you should talk to the upstream
developers and get them to include a config file?

Torfinn Ingolfsen

More information about the freebsd-ports mailing list