From owner-freebsd-ports@FreeBSD.ORG Tue Jun 29 18:49:47 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 65E64106566C for ; Tue, 29 Jun 2010 18:49:47 +0000 (UTC) (envelope-from prvs=789efcd46=pschmehl_lists@tx.rr.com) Received: from ip-001.utdallas.edu (ip-001.utdallas.edu [129.110.20.107]) by mx1.freebsd.org (Postfix) with ESMTP id 36DDD8FC19 for ; Tue, 29 Jun 2010 18:49:46 +0000 (UTC) X-Group: None X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AncGAPPVKUyBbgogUmdsb2JhbACDHZtOZAEkQa9jkSmBKYMJcgSDaQ X-IronPort-AV: E=Sophos;i="4.53,506,1272862800"; d="scan'208";a="34820965" Received: from zxtm01.utdallas.edu (HELO utd65257.utdallas.edu) ([129.110.10.32]) by ip-001.utdallas.edu with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Jun 2010 13:21:05 -0500 Date: Tue, 29 Jun 2010 13:21:07 -0500 From: Paul Schmehl To: Scot Hetzel , Paul Schmehl , Darren Pilgrim Message-ID: <1A5EC514D68C6B623B044F88@utd65257.utdallas.edu> In-Reply-To: References: <4C2993E8.8000504@bitfreak.org> X-Mailer: Mulberry/4.0.6 (Linux/x86) X-Munged-Reply-To: Figure it out MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Cc: FreeBSD Ports Subject: Re: This construction doesn't work X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Paul Schmehl List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 18:49:47 -0000 --On Tuesday, June 29, 2010 09:02:35 -0500 Scot Hetzel =20 wrote: > On Tue, Jun 29, 2010 at 1:34 AM, Darren Pilgrim wrote: >> 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 >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0${INSTALL_DATA} ${WRKSRC}/etc/${f} = ${PREFIX}/etc/${f}-sample >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0[ -f ${PREFIX}/etc/${f} ] || \ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0${INSTALL_DATA} ${WRKSRC}/etc/${f} = ${PREFIX}/etc/${f} >>> .endfor >>> >>> But it gets overwritten anyway. =C2=A0What am I doing wrong? =C2=A0I = thought this >>> worked before, but I can't be sure. =C2=A0Testing proves that it does not = work >>> now. =C2=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; 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 > > 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. You nailed it Scott. The problem was with the Makefile.in in the /etc=20 directory. It's been fixed, and the port upgrade has been submitted. Thanks for the tipoff. --=20 Paul Schmehl, Senior Infosec Analyst As if it wasn't already obvious, my opinions are my own and not those of my employer. ******************************************* "It is as useless to argue with those who have renounced the use of reason as to administer medication to the dead." Thomas Jefferson