7.3. Configuration Files

If the port installs configuration files to PREFIX/etc (or elsewhere) do not list them in pkg-plist. That will cause pkg delete to remove files that have been carefully edited by the user, and a re-installation will wipe them out.

Instead, install sample files with a filename.sample extension. The @sample macro automates this, see 節 7.6.9, “@sample file [file]” for what it does exactly. For each sample file, add a line to pkg-plist:

@sample etc/orbit.conf.sample

If there is a very good reason not to install a working configuration file by default, only list the sample filename in pkg-plist, without the @sample followed by a space part, and add a message pointing out that the user must copy and edit the file before the software will work.


When a port installs its configuration in a subdirectory of ${PREFIX}/etc, use ETCDIR, which defaults to ${PREFIX}/etc/${PORTNAME}, it can be overridden in the ports Makefile if there is a convention for the port to use some other directory. The %%ETCDIR%% macro will be used in its stead in pkg-plist.


The sample configuration files should always have the .sample suffix. If for some historical reason using the standard suffix is not possible, or if the sample files come from some other directory, use this construct:

@sample etc/orbit.conf-dist etc/orbit.conf


@sample %%EXAMPLESDIR%%/orbit.conf etc/orbit.conf

The format is @sample sample-file actual-config-file.

本文及其他文件,可由此下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/

若有 FreeBSD 方面疑問,請先閱讀 FreeBSD 相關文件,如不能解決的話,再洽詢 <questions@FreeBSD.org>。

關於本文件的問題,請洽詢 <doc@FreeBSD.org>。