From owner-freebsd-ports@FreeBSD.ORG Tue Jun 29 14:24:36 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 2DA741065674 for ; Tue, 29 Jun 2010 14:24:36 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id B7F098FC17 for ; Tue, 29 Jun 2010 14:24:35 +0000 (UTC) Received: by wyb34 with SMTP id 34so2185682wyb.13 for ; Tue, 29 Jun 2010 07:24:30 -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=OZwKzE0qvCA87WxdiARo3N16S3p5C7/ccOvHkr64VEg=; b=nMpBrn6OQoiaShO3HHgxSFjr9hDhrHLoQZUSoEbzN1nhIb0MYl75uIC7qHA8THCq2U G18LOM6Db5W7VQ46wzKpOz+hER3i9bZ6HskJTHH5o1bC+KOZGmtWIcnE21zNfsPizk8q QhZVj/4Bkuvv0q/FnGXeX5g+O6BLq4MjGl8XI= 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=F4dP0cGAnSoAL6HudEsxk9GNX7pHEUd1VoGmNQ3txIxg5xJ9I6To+W9zvK7HEldEyB xIGqCPWzy1JItb9DfgjNMA0I1r27TioiaA3AiGXyUeMrdTm6bfP5/RvQbByequ1Uz8HF Jz+LIdrg5sN5izdONPa5tWHahlQANBIYb7N3A= MIME-Version: 1.0 Received: by 10.216.88.6 with SMTP id z6mr5228106wee.79.1277821469572; Tue, 29 Jun 2010 07:24:29 -0700 (PDT) Received: by 10.216.4.65 with HTTP; Tue, 29 Jun 2010 07:24:29 -0700 (PDT) In-Reply-To: References: Date: Tue, 29 Jun 2010 09:24:29 -0500 Message-ID: From: Scot Hetzel To: Paul Schmehl 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:24:36 -0000 On Mon, Jun 28, 2010 at 5:24 PM, Paul Schmehl wr= ote: > 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 con= f > file, if one exists: > > .for f in barnyard2.conf > =A0 =A0 =A0 ${INSTALL_DATA} ${WRKSRC}/etc/${f} ${PREFIX}/etc/${f}-sample > =A0 =A0 =A0 [ -f ${PREFIX}/etc/${f} ] || \ > =A0 =A0 =A0 ${INSTALL_DATA} ${WRKSRC}/etc/${f} ${PREFIX}/etc/${f} > .endfor > > But it gets overwritten anyway. =A0What am I doing wrong? =A0I thought th= is > worked before, but I can't be sure. =A0Testing proves that it does not wo= rk > now. =A0I tried to changing to an if [ ! -f construction, but that didn't= do a > thing. > I did some testing with the following script: cd /usr/ports/security/barnyard2 mkdir -p `make -V WRKSRC`/etc touch `make -V WRKDIR`/pkg-message echo "Test file1" > `make -V WRKSRC`/etc/barnyard2.conf make -DNOPORTDOCS post-install md5 /usr/local/etc/barnyard2.conf* echo "Test file2" > `make -V WRKSRC`/etc/barnyard2.conf make -DNOPORTDOCS post-install md5 /usr/local/etc/barnyard2.conf* With these results: vbox# cd /usr/ports/security/barnyard2 vbox# mkdir -p `make -V WRKSRC`/etc vbox# touch `make -V WRKDIR`/pkg-message vbox# echo "Test file1" > `make -V WRKSRC`/etc/barnyard2.conf vbox# make -DNOPORTDOCS post-install install -o root -g wheel -m 444 /usr/ports/security/barnyard2/work/barnyard2-1.7/etc/barnyard2.conf /usr/local/etc/barnyard2.conf-sample [ -f /usr/local/etc/barnyard2.conf ] || install -o root -g wheel -m 444 /usr/ports/security/barnyard2/work/barnyard2-1.7/etc/barnyard2.conf /usr/local/etc/barnyard2.conf vbox# md5 /usr/local/etc/barnyard2.conf* MD5 (/usr/local/etc/barnyard2.conf) =3D 66e0834ee2cd3f45a229c954894aaead MD5 (/usr/local/etc/barnyard2.conf-sample) =3D 66e0834ee2cd3f45a229c954894a= aead vbox# echo "Test file2" > `make -V WRKSRC`/etc/barnyard2.conf vbox# make -DNOPORTDOCS post-install install -o root -g wheel -m 444 /usr/ports/security/barnyard2/work/barnyard2-1.7/etc/barnyard2.conf /usr/local/etc/barnyard2.conf-sample [ -f /usr/local/etc/barnyard2.conf ] || install -o root -g wheel -m 444 /usr/ports/security/barnyard2/work/barnyard2-1.7/etc/barnyard2.conf /usr/local/etc/barnyard2.conf vbox# md5 /usr/local/etc/barnyard2.conf* MD5 (/usr/local/etc/barnyard2.conf) =3D 66e0834ee2cd3f45a229c954894aaead MD5 (/usr/local/etc/barnyard2.conf-sample) =3D 2ef1fb610a51b51da31397511cac= 748f The first time I ran `make post-install`, both barnyard2.conf and barnyard2.conf-sample were installed, and then when the 2nd `make post-install` was run, only barnyard2.conf-sample was updated. If didn't overwrite the existing barnyard2.conf. Run the above script on your update port, and see if you get the same results. If you do, then the problem is not with the ports Makefile, but with the sources Makefile installing barnyard2.conf. Scot