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:

	@${MKDIR} ${STAGEDIR}${PREFIX}/some/directory

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

@dir some/directory

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.