From c010f57674665ac1af72bebad8ecac860e5b15ab Mon Sep 17 00:00:00 2001 From: Warren Block Date: Mon, 2 Apr 2012 20:31:56 +0000 Subject: [PATCH] Clarify the configuration files section. PR: docs/166541 Submitted by: Mel Flynn --- .../books/porters-handbook/book.sgml | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/en_US.ISO8859-1/books/porters-handbook/book.sgml b/en_US.ISO8859-1/books/porters-handbook/book.sgml index b9eda982de..318fa575c5 100644 --- a/en_US.ISO8859-1/books/porters-handbook/book.sgml +++ b/en_US.ISO8859-1/books/porters-handbook/book.sgml @@ -9378,20 +9378,39 @@ lib/X11/oneko/sounds/cat.au ${CP} -p ${PREFIX}/etc/orbit.conf.sample ${PREFIX}/etc/orbit.conf ; \ fi - Example of the pkg-plist part: + For each configuration file, create the following three + lines in pkg-plist: @unexec if cmp -s %D/etc/orbit.conf.sample %D/etc/orbit.conf; then rm -f %D/etc/orbit.conf; fi etc/orbit.conf.sample @exec if [ ! -f %D/etc/orbit.conf ] ; then cp -p %D/%F %B/orbit.conf; fi - For information on the above variables see - &man.pkg.create.1; + The order of these lines is important. On deinstallation, + the sample file is compared to the actual configuration file. + If these files are identical, no changes have been made by the + user and the actual file can be safely deleted. Because the + sample file must still exist for the comparison, the + @unexec line comes before the sample + configuration file name. On installation, if an actual + configuration file is not already present, the sample file is + copied to the actual file. The sample file must be present + before it can be copied, so the @exec line + comes after the sample configuration file name. + + To debug any issues, temporarily remove the + -s flag to &man.cmp.1; for more + output. + + See &man.pkg.create.1; for more information on + %D and related substitution markers. If there is a very good reason not to install a working - configuration file by default, use a @exec line out of + pkg-plist and add a message pointing out that - the user has to copy and edit the file before the software can - be made to work. + the user must copy and edit the file before the software will + work.