From: Paul Schmehl on 28 Jun 2010 18:24 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. -- 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 _______________________________________________ freebsd-ports(a)freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"
From: Gabor Kovesdan on 28 Jun 2010 19:13 Em 2010.06.29. 0:24, Paul Schmehl escreveu: > 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. > I think it should work, I used to write the same in audio/shoutcast. Are you testing by installing from port or from package? It should work for ports but for packages, you need some more magic in pkg-plist. You can also refer to audio/shoutcast how it is done there. Maybe is it what you missed? Regards, Gabor _______________________________________________ freebsd-ports(a)freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"
From: Darren Pilgrim on 29 Jun 2010 02:34 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 _______________________________________________ freebsd-ports(a)freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"
From: Scot Hetzel on 29 Jun 2010 10:24 On Mon, Jun 28, 2010 at 5:24 PM, Paul Schmehl <pschmehl_lists(a)tx.rr.com> 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. > 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) = 66e0834ee2cd3f45a229c954894aaead MD5 (/usr/local/etc/barnyard2.conf-sample) = 66e0834ee2cd3f45a229c954894aaead 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) = 66e0834ee2cd3f45a229c954894aaead MD5 (/usr/local/etc/barnyard2.conf-sample) = 2ef1fb610a51b51da31397511cac748f 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 _______________________________________________ freebsd-ports(a)freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"
From: Scot Hetzel on 29 Jun 2010 10:02
On Tue, Jun 29, 2010 at 1:34 AM, Darren Pilgrim <freebsd(a)bitfreak.org> 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 >> ${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. 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. Scot _______________________________________________ freebsd-ports(a)freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org" |