View | Details | Raw Unified | Return to bug 265476
Collapse All | Expand All

(-)b/documentation/content/en/books/porters-handbook/pkg-files/_index.adoc (-11 / +33 lines)
Lines 223-256 Most of the time it is by using `maximum_version` to limit its usage to upgrades Link Here
223
====
223
====
224
224
225
[[pkg-install]]
225
[[pkg-install]]
226
== pkg-install
226
== pkg-install, pkg-pre-install and pkg-post-install
227
227
228
If the port needs to execute commands when the binary package is installed with `pkg add` or `pkg install`, use [.filename]#pkg-install#.
228
If the port needs to execute commands when the binary package is installed with `pkg add` or `pkg install`, use [.filename]#pkg-install#.
229
This script will automatically be added to the package.
230
It will be run twice by `pkg`, the first time as `${SH} pkg-install ${PKGNAME} PRE-INSTALL` before the package is installed, and the second time as `${SH} pkg-install ${PKGNAME} POST-INSTALL` after it has been installed.
229
It will be run twice by `pkg`, the first time as `${SH} pkg-install ${PKGNAME} PRE-INSTALL` before the package is installed, and the second time as `${SH} pkg-install ${PKGNAME} POST-INSTALL` after it has been installed.
231
`$2` can be tested to determine which mode the script is being run in.
230
`$2` can be tested to determine which mode the script is being run in.
232
The `PKG_PREFIX` environmental variable will be set to the package installation directory.
231
The `PKG_PREFIX` environmental variable will be set to the package installation directory.
233
232
233
If you use [.filename]#pkg-pre-install# or [.filename]#pkg-post-install# instead, the script is only run once, before or after installation of the package.
234
You can also use [.filename]#pkg-pre-install.lua# or [.filename]#pkg-post-install.lua# to run a lua script instead of a shell script.
235
Lua scripts run by `pkg` provide some extensions and a few restrictions, for these see man:pkg-lua-script[5].
236
237
These scripts will automatically be added to the package.
238
234
[IMPORTANT]
239
[IMPORTANT]
235
====
240
====
236
This script is here to help you set up the package so that it is as ready to use as possible.
241
These scripts are here to help you set up the package so that it is as ready to use as possible.
237
It _must not_ be abused to start services, stop services, or run any other commands that will modify the currently running system.
242
They _must not_ be abused to start services, stop services, or run any other commands that will modify the currently running system.
238
====
243
====
239
244
240
[[pkg-deinstall]]
245
[[pkg-deinstall]]
241
== pkg-deinstall
246
== pkg-deinstall, pkg-pre-deinstall and pkg-post-deinstall
242
247
243
This script executes when a package is removed.
248
These scripts execute when a package is removed.
244
249
245
This script will be run twice by `pkg delete`.
250
The [.filename]#pkg-deinstall# script will be run twice by `pkg delete`.
246
The first time as `${SH} pkg-deinstall ${PKGNAME} DEINSTALL` before the port is de-installed and the second time as `${SH} pkg-deinstall ${PKGNAME} POST-DEINSTALL` after the port has been de-installed.
251
The first time as `${SH} pkg-deinstall ${PKGNAME} DEINSTALL` before the port is de-installed and the second time as `${SH} pkg-deinstall ${PKGNAME} POST-DEINSTALL` after the port has been de-installed.
247
`$2` can be tested to determine which mode the script is being run in.
252
`$2` can be tested to determine which mode the script is being run in.
248
The `PKG_PREFIX` environmental variable will be set to the package installation directory
253
The `PKG_PREFIX` environmental variable will be set to the package installation directory.
254
255
If you use [.filename]#pkg-pre-deinstall# or [.filename]#pkg-post-deinstall# instead, the script is only run once, before or after removal of the package.
256
You can also use [.filename]#pkg-pre-deinstall.lua# or [.filename]#pkg-post-deinstall.lua# to run a lua script instead of a shell script.
257
Lua scripts run by `pkg` provide some extensions and a few restrictions, for these see man:pkg-lua-script[5].
258
259
These scripts will automatically be added to the package.
249
260
250
[IMPORTANT]
261
[IMPORTANT]
251
====
262
====
252
This script is here to help you set up the package so that it is as ready to use as possible.
263
These scripts are here to help you set up the package so that it is as ready to use as possible.
253
It _must not_ be abused to start services, stop services, or run any other commands that will modify the currently running system.
264
They _must not_ be abused to start services, stop services, or run any other commands that will modify the currently running system.
254
====
265
====
255
266
256
[[pkg-names]]
267
[[pkg-names]]
Lines 278-286 Here is a list of variable names and their default values. Link Here
278
|`PKGINSTALL`
289
|`PKGINSTALL`
279
|`${PKGDIR}/pkg-install`
290
|`${PKGDIR}/pkg-install`
280
291
292
|`PKGPREINSTALL`
293
|`${PKGDIR}/pkg-pre-install`
294
295
|`PKGPOSTINSTALL`
296
|`${PKGDIR}/pkg-post-install`
297
281
|`PKGDEINSTALL`
298
|`PKGDEINSTALL`
282
|`${PKGDIR}/pkg-deinstall`
299
|`${PKGDIR}/pkg-deinstall`
283
300
301
|`PKGPREDEINSTALL`
302
|`${PKGDIR}/pkg-pre-deinstall`
303
304
|`PKGPOSTDEINSTALL`
305
|`${PKGDIR}/pkg-post-deinstall`
306
284
|`PKGMESSAGE`
307
|`PKGMESSAGE`
285
|`${PKGDIR}/pkg-message`
308
|`${PKGDIR}/pkg-message`
286
|===
309
|===
287
- 

Return to bug 265476