From owner-svn-doc-head@freebsd.org Thu Oct 1 14:34:27 2015 Return-Path: Delivered-To: svn-doc-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BDABA0C23B; Thu, 1 Oct 2015 14:34:27 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2314B1579; Thu, 1 Oct 2015 14:34:27 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91EYRwY026726; Thu, 1 Oct 2015 14:34:27 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91EYRlo026725; Thu, 1 Oct 2015 14:34:27 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201510011434.t91EYRlo026725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Thu, 1 Oct 2015 14:34:26 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r47467 - head/en_US.ISO8859-1/books/porters-handbook/plist X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the doc tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 14:34:27 -0000 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 Real Life Example, How <literal>@sample</literal> is Implemented - This keyword does three things, it adds the + This keyword does three things. It adds the first filename passed as an argument to @sample to the packing list, it adds to the post-install script instructions to @@ -890,27 +890,46 @@ EOD post-deinstall instructions to remove the configuration file if it has not been modified. - actions: [file] + actions: [file(1)] +arguments: true post-install: <<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}" && \ + /bin/chmod u+w "${target_file}" fi EOD pre-deinstall: <<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