8.2. `pkg-install`
前一頁 | 章 8. The `pkg-`*`` files | 下一頁

## 8.2. `pkg-install`

If your port needs to execute commands when the binary package is installed with pkg_add(1) you can do this via the `pkg-install` script. This script will automatically be added to the package, and will be run twice by pkg_add(1): the first time as `${SH} pkg-install ${PKGNAME} PRE-INSTALL` and the second time as `${SH} pkg-install ${PKGNAME} POST-INSTALL`. `$2` can be tested to determine which mode the script is being run in. The `PKG_PREFIX` environmental variable will be set to the package installation directory. See pkg_add(1) for additional information.

### 注意:

This script is not run automatically if you install the port with `make install`. If you are depending on it being run, you will have to explicitly call it from your port's `Makefile`, with a line like `PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL`.

前一頁 | 上一層 | 下一頁
章 8. The `pkg-`*`` files | 起始頁 | 8.3. `pkg-deinstall`

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

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