7.2. Empty Directories

7.2.1. Cleaning Up Empty Directories

When being de-installed, a port has to remove empty directories it created. Most of these directories are removed automatically by pkg(8), but for directories created outside of ${PREFIX}, or empty directories, some more work needs to be done. This is usually accomplished by adding @dir lines for those directories. Subdirectories must be deleted before deleting parent directories.

[...]
@dir /var/games/oneko/saved-games
@dir /var/games/oneko

7.2.2. Creating Empty Directories

Empty directories created during port installation need special attention. They must be present when the package is created. If they are not created by the port code, create them in the Makefile:

post-stage:
	@${MKDIR} ${STAGEDIR}${PREFIX}/some/directory

Add the directory to pkg-plist like any other. For example:

@dir some/directory

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

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

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