svn commit: r47467 - head/en_US.ISO8859-1/books/porters-handbook/plist

Mathieu Arnold <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
Author: mat
Date: Thu Oct  1 14:34:26 2015
New Revision: 47467
URL: https://svnweb.freebsd.org/changeset/doc/47467

Log:
  Update the @sample example to catch up with reality.
  
  Reviewed by:	brd, wblock
  Sponsored by:	Absolight
  Differential Revision:	https://reviews.freebsd.org/D3755

Modified:
  head/en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml

Modified: head/en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml
==============================================================================
--- head/en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml	Thu Oct  1 14:34:20 2015	(r47466)
+++ head/en_US.ISO8859-1/books/porters-handbook/plist/chapter.xml	Thu Oct  1 14:34:26 2015	(r47467)
@@ -881,7 +881,7 @@ EOD</programlisting>
 	<title>Real Life Example, How <literal>@sample</literal>
 	  is Implemented</title>
 
-	<para>This keyword does three things, it adds the
+	<para>This keyword does three things.  It adds the first
 	  <replaceable>filename</replaceable> passed as an argument to
 	  <literal>@sample</literal> to the packing list, it adds to
 	  the <literal>post-install</literal> script instructions to
@@ -890,27 +890,46 @@ EOD</programlisting>
 	  <literal>post-deinstall</literal> instructions to remove the
 	  configuration file if it has not been modified.</para>
 
-	<programlisting>actions: [file]
+	<programlisting>actions: [file(1)]
+arguments: true
 post-install: &lt;&lt;EOD
-  case "%@" in
-  /*) sample_file="%@" ;;
-  *) sample_file="%D/%@" ;;
+  case "%1" in
+  /*) sample_file="%1" ;;
+  *) sample_file="%D/%1" ;;
   esac
   target_file="${sample_file%.sample}"
+  set -- %@
+  if [ $# -eq 2 ]; then
+      target_file=${2}
+  fi
+  case "${target_file}" in
+  /*) target_file="${target_file}" ;;
+  *) target_file="%D/${target_file}" ;;
+  esac
   if ! [ -f "${target_file}" ]; then
-    /bin/cp -p "${sample_file}" "${target_file}"
+    /bin/cp -p "${sample_file}" "${target_file}" &amp;&amp; \
+      /bin/chmod u+w "${target_file}"
   fi
 EOD
 pre-deinstall: &lt;&lt;EOD
-  case "%@" in
-  /*) sample_file="%@" ;;
-  *) sample_file="%D/%@" ;;
+  case "%1" in
+  /*) sample_file="%1" ;;
+  *) sample_file="%D/%1" ;;
   esac
   target_file="${sample_file%.sample}"
+  set -- %@
+  if [ $# -eq 2 ]; then
+      set -- %@
+      target_file=${2}
+  fi
+  case "${target_file}" in
+  /*) target_file="${target_file}" ;;
+  *) target_file="%D/${target_file}" ;;
+  esac
   if cmp -s "${target_file}" "${sample_file}"; then
     rm -f "${target_file}"
   else
-    echo "You may need to manually remove ${target_file} if it's no longer needed."
+    echo "You may need to manually remove ${target_file} if it is no longer needed."
   fi
 EOD</programlisting>
       </example>
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.