From owner-svn-doc-all@freebsd.org Thu Jun 6 11:26:56 2019 Return-Path: Delivered-To: svn-doc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A41115AF9A4; Thu, 6 Jun 2019 11:26:56 +0000 (UTC) (envelope-from mat@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 99B048FE11; Thu, 6 Jun 2019 11:26:55 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7215E1BC56; Thu, 6 Jun 2019 11:26:55 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x56BQt1m019255; Thu, 6 Jun 2019 11:26:55 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x56BQtSn019254; Thu, 6 Jun 2019 11:26:55 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201906061126.x56BQtSn019254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Thu, 6 Jun 2019 11:26:55 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r53113 - head/en_US.ISO8859-1/books/porters-handbook/pkg-files X-SVN-Group: doc-head X-SVN-Commit-Author: mat X-SVN-Commit-Paths: head/en_US.ISO8859-1/books/porters-handbook/pkg-files X-SVN-Commit-Revision: 53113 X-SVN-Commit-Repository: doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 99B048FE11 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-doc-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire doc trees \(except for " user" , " projects" , and " translations" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jun 2019 11:26:56 -0000 Author: mat Date: Thu Jun 6 11:26:55 2019 New Revision: 53113 URL: https://svnweb.freebsd.org/changeset/doc/53113 Log: Document using UCL in pkg-message. Reviewed by: bapt, bcr Differential Revision: https://reviews.freebsd.org/D20512 Modified: head/en_US.ISO8859-1/books/porters-handbook/pkg-files/chapter.xml Modified: head/en_US.ISO8859-1/books/porters-handbook/pkg-files/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/porters-handbook/pkg-files/chapter.xml Thu Jun 6 02:39:50 2019 (r53112) +++ head/en_US.ISO8859-1/books/porters-handbook/pkg-files/chapter.xml Thu Jun 6 11:26:55 2019 (r53113) @@ -24,26 +24,232 @@ steps to be taken after a pkg install or to display licensing information. - When some lines about the build-time knobs or warnings - have to be displayed, use ECHO_MSG. - pkg-message is only for - post-installation steps. Likewise, the distinction between - ECHO_MSG is for printing - informational text to the screen and ECHO_CMD - is for - command pipelining: + pkg-message supports two formats: - update-etc-shells: - @${ECHO_MSG} "updating /etc/shells" - @${CP} /etc/shells /etc/shells.bak - @( ${GREP} -v ${PREFIX}/bin/bash /etc/shells.bak; \ - ${ECHO_CMD} ${PREFIX}/bin/bash) >/etc/shells - @${RM} /etc/shells.bak + + + raw + + A regular plain text file. Its message is always + displayed, on install, and on upgrade. + + + + + UCL + + + If the file starts with + [ then it is considered + to be a UCL file. The + UCL format is + described on libucl's + GitHub page. + + + + Do not add an entry for pkg-message in pkg-plist. + + + <acronym>UCL</acronym> in + <filename>pkg-message</filename> + + The format is the following. It should be an array of + objects. The objects themselves can have these + keywords: + + + + message + + + The actual message to be displayed. This keyword is + mandatory. + + + + + type + + + When the message should be displayed. + + + + + maximum_version + + + Only if type is + upgrade. Display if upgrading from a + version strictly lower than the version + specified. + + + + + minimum_version + + + Only if type is + upgrade. Display if upgrading from a + version stictly greater than the version + specified. + + + + + The maximum_version and + minimum_version keywords can be + combined. + + The type keyword can have four + values: + + + + (no type specified) + + + The message is always displayed. + + + + + install + + + The message should only be displayed when the + package is installed. + + + + + remove + + + The message should only be displayed when the + package is removed. + + + + + upgrade + + + the message should only be displayed during an + upgrade of the package.. + + + + + + UCL allows for two kind of strings, either delimited + by double quotes + "foo", or as a + here document. These two + are equivalent: + + [ +{ message: "Always displayed" +} +] + + [ +{ message: <<EOM +Always displayed +EOM +} +] + + + + To preserve the compatibility with non + UCL pkg-message + files, the first line of a UCL + pkg-message MUST + be a single + [, and the last line + MUST be a single + ]. + + + + Always Display a Message + + If a port has a pkg-message + containing simple text, it can be transformed into + UCL easily. Given this + pkg-message: + + * BIND requires configuration of rndc, including a "secret" key. * +* The easiest, and most secure way to configure rndc is to run * +* 'rndc-confgen -a' to generate the proper conf file, with a new * +* random key, and appropriate file permissions. * + + [ +{ + message: <<EOD +* BIND requires configuration of rndc, including a "secret" key. * +* The easiest, and most secure way to configure rndc is to run * +* 'rndc-confgen -a' to generate the proper conf file, with a new * +* random key, and appropriate file permissions. * +EOD +} +] + + + + Display a Message on Install/Deinstall + + When a message only needs to be displayed on + installation or uninstallation, set the type: + + [ +{ + message: "package being removed." + type: remove +} +{ message: "package being installed.", type: install } +] + + + + Display a Message on Upgrade + + When a port is upgraded, the message displayed can be + even more tailored to the port's needs. + + [ +{ + message: "Package is being upgraded." + type: upgrade +} +{ + message: "Upgrading from before 1.0 need to do this." + maximum_version: "1.0" + type: upgrade +} +{ + message: "Upgrading from after 1.0 should do that." + minimum_version: "1.0" + type: upgrade +} +{ + message: "Upgrading from > 1.0 and < 3.0 remove that file." + maximum_version: "3.0" + minimum_version: "1.0" + type: upgrade +} +] + +