Date: Tue, 29 Jun 2010 09:24:29 -0500 From: Scot Hetzel <swhetzel@gmail.com> To: Paul Schmehl <pschmehl_lists@tx.rr.com> Cc: FreeBSD Ports <freebsd-ports@freebsd.org> Subject: Re: This construction doesn't work Message-ID: <AANLkTilmtpQBK5Ejzm5Zxp3vptLV_WYd0saOQAUO5Bu3@mail.gmail.com> In-Reply-To: <F2F73A9F749C437672E35BFB@utd65257.utdallas.edu> References: <F2F73A9F749C437672E35BFB@utd65257.utdallas.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 28, 2010 at 5:24 PM, Paul Schmehl <pschmehl_lists@tx.rr.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTilmtpQBK5Ejzm5Zxp3vptLV_WYd0saOQAUO5Bu3>