Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jun 2010 09:02:35 -0500
From:      Scot Hetzel <swhetzel@gmail.com>
To:        Paul Schmehl <pschmehl_lists@tx.rr.com>, Darren Pilgrim <freebsd@bitfreak.org>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: This construction doesn't work
Message-ID:  <AANLkTimNq_7L-_A4oEZRo9aNvb_qUdjEhTbXclcRCWgW@mail.gmail.com>
In-Reply-To: <4C2993E8.8000504@bitfreak.org>
References:  <F2F73A9F749C437672E35BFB@utd65257.utdallas.edu> <4C2993E8.8000504@bitfreak.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jun 29, 2010 at 1:34 AM, Darren Pilgrim <freebsd@bitfreak.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimNq_7L-_A4oEZRo9aNvb_qUdjEhTbXclcRCWgW>