From owner-freebsd-ports@FreeBSD.ORG Tue Jun 29 14:30:21 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 24F1B1065673 for ; Tue, 29 Jun 2010 14:30:21 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from mail-ww0-f54.google.com (mail-ww0-f54.google.com [74.125.82.54]) by mx1.freebsd.org (Postfix) with ESMTP id AB1068FC18 for ; Tue, 29 Jun 2010 14:30:20 +0000 (UTC) Received: by wwb28 with SMTP id 28so1412306wwb.13 for ; Tue, 29 Jun 2010 07:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=t7d4kSD1MTPXcBV8kloLjNFplChr73AXZkUmwuAEJxM=; b=I2Yr4Y9D2euWpVHHj1LdrDMfFwbahPBDPDR6AQmqHbEiJFWW1Ub6BZmgXjL+dvu0vF FUxZcsceEAqa2zNQdxclKkl1A9GLPC6XmPFPOt4giIlZNaDyVCL7JjcAoMmdqQ7jh8te +jqugkx0ujXghkmSPTPn2BMfanz/DmfyWI9j0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=FGXYw7aoYQmJWUqzwFSR4MRCrLszsM8LiFdji1rlzsXK+c+wG2lkcXIbH5lD2R5knQ Q2fySvlVPQfiRMJuIWAwB8kXtBj/A5afKWpNWg4op/CNb3fbY86znjEKxDwRQDIAOZJy rwC2922tNVNB1dgyviB7tX8Yx7znpXOPCe1Xk= MIME-Version: 1.0 Received: by 10.216.87.74 with SMTP id x52mr5189564wee.4.1277820155510; Tue, 29 Jun 2010 07:02:35 -0700 (PDT) Received: by 10.216.4.65 with HTTP; Tue, 29 Jun 2010 07:02:35 -0700 (PDT) In-Reply-To: <4C2993E8.8000504@bitfreak.org> References: <4C2993E8.8000504@bitfreak.org> Date: Tue, 29 Jun 2010 09:02:35 -0500 Message-ID: From: Scot Hetzel To: Paul Schmehl , Darren Pilgrim Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 14:30:21 -0000 On Tue, Jun 29, 2010 at 1:34 AM, Darren Pilgrim wrot= e: > 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 co= nf >> file, if one exists: >> >> .for f in barnyard2.conf >> =A0 =A0 =A0 =A0${INSTALL_DATA} ${WRKSRC}/etc/${f} ${PREFIX}/etc/${f}-sam= ple >> =A0 =A0 =A0 =A0[ -f ${PREFIX}/etc/${f} ] || \ >> =A0 =A0 =A0 =A0${INSTALL_DATA} ${WRKSRC}/etc/${f} ${PREFIX}/etc/${f} >> .endfor >> >> But it gets overwritten anyway. =A0What am I doing wrong? =A0I thought t= his >> worked before, but I can't be sure. =A0Testing proves that it does not w= ork >> now. =A0I tried to changing to an if [ ! -f construction, but that didn'= t do a >> thing. The above may be working properly, the problem could be that the sources have code in them that installs barnyard2.conf to PREFIX/etc/. Check the sources Makefile to see if they are installing this file. If they are, patch them to install the file as the *-sample. > > Instead of doing this in Makefile, do it in pkg-plist: > > @unexec if cmp -s %D/etc/barnyard2.conf.sample %D/etc/barnyard2.conf; the= n > 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 While this works when installing a package, you still need code in the Makefile to install barnyard2.conf if it doesn't exist when installing the port. Scot