How to tell pkg it's OK to overwrite files by another port

Tijl Coosemans tijl at FreeBSD.org
Sat Aug 9 13:36:36 UTC 2014


On Sat, 9 Aug 2014 14:27:05 +0200 (CEST) Melvyn Sopacua wrote:
> On Wed, 6 Aug 2014, Baptiste Daroussin wrote: 
>> On Wed, Aug 06, 2014 at 09:19:48PM +0200, Melvyn Sopacua wrote:
>>> Both are candidates for myconfig.conf, where optimized should win and
>>> otherwise default, but they come from two different ports. This may
>>> actually be the way to handle it, if @sample didn't assume the same
>>> basename.
>> 
>> There is the @sample keyword for that ;)
> 
> I don't think there is.
> @sample foo.sample sets target_file to foo. There's no way to specify
> that target_file should be bar.
> If two ports have the same .sample file, there is still a conflict. So
> in my case, I need two different .sample files installing to a shared
> target_file.
> 
> I think this is a corner case, so I'll stick it in a custom pkg-install.

You can use @sample in the base port and in the optimized port you
can replace the original config if it's still the same as the sample
config.  Something like this:

@unexec if cmp -s %D/etc/foo.conf %D/etc/optimized.conf.sample; then cp %D/etc/foo.conf.sample %D/etc/foo.conf; fi
etc/optimized.conf.sample
@exec if cmp -s %D/etc/foo.conf %D/etc/foo.conf.sample; then cp %B/%f %B/foo.conf; fi


More information about the freebsd-ports mailing list