From nobody Fri Jul 29 22:08:53 2022 X-Original-To: doc@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LvhVt1KlCz4X5W3 for ; Fri, 29 Jul 2022 22:08:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LvhVs6jFqz3THv for ; Fri, 29 Jul 2022 22:08:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LvhVs5VmdzrFx for ; Fri, 29 Jul 2022 22:08:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 26TM8rL5020114 for ; Fri, 29 Jul 2022 22:08:53 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 26TM8rgD020113 for doc@FreeBSD.org; Fri, 29 Jul 2022 22:08:53 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: doc@FreeBSD.org Subject: [Bug 265476] porters-handbook: add documentation of pkg-{pre,post}-[de]install[.lua] Date: Fri, 29 Jul 2022 22:08:53 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Documentation X-Bugzilla-Component: Books & Articles X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: pauamma@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: doc@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Documentation project List-Archive: https://lists.freebsd.org/archives/freebsd-doc List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-doc@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659132533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AjI1ustKnE3n/OkYZquu/d09NgvkL3hqoYZ0IqCP7QA=; b=S+r8ZvLMQ6lUKpYp8dNG4agoRA30IWa5/yTPiXBaUk8f3HPThodERvZJUrZu8S99T7yAEw JlTmpe/XjqrVoYVjfcgqvwYxUcOoXzNiX73z4WkzqCiGzfvQwQXx9Gr52V3UO1jAQPbi9U 2XDzyBopoq+2ShdNFjnYkokuLQhFM8sXHQjx0ZDCgBPYrLQwXl+3VCR+CPFZyUq+7jTlrD 2dFsCwF5Plr0L/+E9LYeI4H6HSLpeqyjH8jVn9ISC9a4lwHNWzQ8l5+hUPz2yB4hFbVKQF 1FhwUNKM1fKhIjPB6oQxAqB9ip9u3c6drF8rSmlr4UnTud3MsM00IBV0dYSfIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659132533; a=rsa-sha256; cv=none; b=XzKVK/g2y7pkCtc4eEmj1M2bHngi1ycCnUfQfm2tTfiiYCrBpMTE+IqwsNZfkCQxt1bTSW CRw7pH9zhe9KFOkeE6WutfeHBAGFKBNqHlnViysg6iqCRNtZ8+jt9o12nBISg6FhJxcthU TxehTNlORHBnHPnc+oZZIiciwv0D2gRxeXfKGaN/semVYbw/Z5cUgqIIe97gI2nu6A4e8E j9Lz1xTuUT0Ax5iixjeDswtJHXHuFNA6M5CdTgskzPCGItUicmid9wrP9K1HdFPWDx1++a kLCdBxyyprfCrq1OO3mvlLBid39FfescZUPChQMq2SKt5+DyMZiOhDbaxPyHPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265476 --- Comment #2 from Pau Amma --- Comment on attachment 235522 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D235522 0001-en-porters-handbook-Add-pkg-de-install-variants >>From 6d224058b05f25f56b24fa90190b75f1d220aa98 Mon Sep 17 00:00:00 2001 >From: Felix Palmen >Date: Thu, 28 Jul 2022 11:01:25 +0200 >Subject: [PATCH] en/porters-handbook: Add pkg-[de]install variants > >These scripts support "pre" and "post" variants, and these can also be >written in lua (by adding the ".lua" extension). >--- > .../porters-handbook/pkg-files/_index.adoc | 43 ++++++++++++++----- > 1 file changed, 33 insertions(+), 10 deletions(-) > >diff --git a/documentation/content/en/books/porters-handbook/pkg-files/_in= dex.adoc b/documentation/content/en/books/porters-handbook/pkg-files/_index= .adoc >index 969e0b9f43..de5f8038b7 100644 >--- a/documentation/content/en/books/porters-handbook/pkg-files/_index.adoc >+++ b/documentation/content/en/books/porters-handbook/pkg-files/_index.adoc >@@ -223,34 +223,45 @@ Most of the time it is by using `maximum_version` to= limit its usage to upgrades > =3D=3D=3D=3D >=20 > [[pkg-install]] >-=3D=3D pkg-install >+=3D=3D pkg-install, pkg-pre-install and pkg-post-install >=20 > If the port needs to execute commands when the binary package is installe= d with `pkg add` or `pkg install`, use [.filename]#pkg-install#. >-This script will automatically be added to the package. > It will be run twice by `pkg`, the first time as `${SH} pkg-install ${PKG= NAME} PRE-INSTALL` before the package is installed, and the second time as = `${SH} pkg-install ${PKGNAME} POST-INSTALL` after it has been installed. > `$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 instal= lation directory. >=20 >+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 p= ackage. Command line? Specifically, does it also have a $2? >+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. Invocation command? >+Lua scripts run by `pkg` provide some extensions and a few restrictions, = for these see man:pkg-lua-script[5]. Lua scripts run by `pkg` provide some extensions and a few restrictions, bo= th explained in man:pkg-lua-script[5]. >+ >+These scripts will automatically be added to the package. Do you mean the packing list? >+ > [IMPORTANT] > =3D=3D=3D=3D >-This script is here to help you set up the package so that it is as ready= to use as possible. >-It _must not_ be abused to start services, stop services, or run any othe= r commands that will modify the currently running system. >+These scripts are here to help you set up the package so that it is as re= ady to use as possible. While here, s/you // for style conformance. (Besides that, it's not you, the maintainer, it's the user or sysadmin installing the package.) >+They _must not_ be abused to start services, stop services, or run any ot= her commands that will modify the currently running system. > =3D=3D=3D=3D >=20 > [[pkg-deinstall]] >-=3D=3D pkg-deinstall >+=3D=3D pkg-deinstall, pkg-pre-deinstall and pkg-post-deinstall >=20 >-This script executes when a package is removed. >+These scripts execute when a package is removed. >=20 >-This script will be run twice by `pkg delete`. >+The [.filename]#pkg-deinstall# script will be run twice by `pkg delete`. > The first time as `${SH} pkg-deinstall ${PKGNAME} DEINSTALL` before the p= ort is de-installed and the second time as `${SH} pkg-deinstall ${PKGNAME} = POST-DEINSTALL` after the port has been de-installed. > `$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 instal= lation directory >+The `PKG_PREFIX` environmental variable will be set to the package instal= lation directory. >+ >+If you use [.filename]#pkg-pre-deinstall# or [.filename]#pkg-post-deinsta= ll# instead, the script is only run once, before or after removal of the pa= ckage. $2? >+You can also use [.filename]#pkg-pre-deinstall.lua# or [.filename]#pkg-po= st-deinstall.lua# to run a lua script instead of a shell script. Invocation command? >+Lua scripts run by `pkg` provide some extensions and a few restrictions, = for these see man:pkg-lua-script[5]. >+ >+These scripts will automatically be added to the package. packing list? (as above) >=20 > [IMPORTANT] > =3D=3D=3D=3D >-This script is here to help you set up the package so that it is as ready= to use as possible. >-It _must not_ be abused to start services, stop services, or run any othe= r commands that will modify the currently running system. >+These scripts are here to help you set up the package so that it is as re= ady to use as possible. s/you // as above. >+They _must not_ be abused to start services, stop services, or run any ot= her commands that will modify the currently running system. > =3D=3D=3D=3D >=20 > [[pkg-names]] >@@ -278,9 +289,21 @@ Here is a list of variable names and their default va= lues. > |`PKGINSTALL` > |`${PKGDIR}/pkg-install` >=20 >+|`PKGPREINSTALL` >+|`${PKGDIR}/pkg-pre-install` >+ >+|`PKGPOSTINSTALL` >+|`${PKGDIR}/pkg-post-install` >+ > |`PKGDEINSTALL` > |`${PKGDIR}/pkg-deinstall` >=20 >+|`PKGPREDEINSTALL` >+|`${PKGDIR}/pkg-pre-deinstall` >+ >+|`PKGPOSTDEINSTALL` >+|`${PKGDIR}/pkg-post-deinstall` >+ > |`PKGMESSAGE` > |`${PKGDIR}/pkg-message` > |=3D=3D=3D >--=20 >2.37.1 > --=20 You are receiving this mail because: You are the assignee for the bug.=