From owner-freebsd-ports@FreeBSD.ORG Tue Jun 29 06:34:25 2010 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE0BC1065677 for ; Tue, 29 Jun 2010 06:34:25 +0000 (UTC) (envelope-from freebsd@bitfreak.org) Received: from epona.bluerosetech.com (epona.bluerosetech.com [204.109.56.17]) by mx1.freebsd.org (Postfix) with ESMTP id C70F18FC19 for ; Tue, 29 Jun 2010 06:34:25 +0000 (UTC) Received: from vivi.cat.pdx.edu (vivi.cat.pdx.edu [131.252.214.6]) by epona.bluerosetech.com (Postfix) with ESMTPSA id E50375C052; Mon, 28 Jun 2010 23:34:24 -0700 (PDT) Received: from [127.0.0.1] (c-71-236-134-213.hsd1.wa.comcast.net [71.236.134.213]) by vivi.cat.pdx.edu (Postfix) with ESMTPSA id 3808324CA5; Mon, 28 Jun 2010 23:34:21 -0700 (PDT) Message-ID: <4C2993E8.8000504@bitfreak.org> Date: Mon, 28 Jun 2010 23:34:16 -0700 From: Darren Pilgrim User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Paul Schmehl References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Ports Subject: Re: This construction doesn't work X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 06:34:26 -0000 Paul Schmehl wrote: > I'm working on a port update for one of the ports that I maintain, and I've run > into a problem that I can't seem to solve. > > I use this construction to ensure that the port doesn't overwrite the conf > file, if one exists: > > .for f in barnyard2.conf > ${INSTALL_DATA} ${WRKSRC}/etc/${f} ${PREFIX}/etc/${f}-sample > [ -f ${PREFIX}/etc/${f} ] || \ > ${INSTALL_DATA} ${WRKSRC}/etc/${f} ${PREFIX}/etc/${f} > .endfor > > But it gets overwritten anyway. What am I doing wrong? I thought this worked > before, but I can't be sure. Testing proves that it does not work now. I > tried to changing to an if [ ! -f construction, but that didn't do a thing. Instead of doing this in Makefile, do it in pkg-plist: @unexec if cmp -s %D/etc/barnyard2.conf.sample %D/etc/barnyard2.conf; then rm -f %D/etc/barnyard2.conf; fi etc/barnyard2.conf.sample @exec if [ ! -f %D/etc/barnyard2.conf ] ; then cp -p %D/%F %D/etc/barnyard2.conf && chmod 600 %D/etc/barnyard2.conf; fi Relevant section of the Porter's Handbook: http://www.freebsd.org/doc/en/books/porters-handbook/plist-config.html