Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Apr 2019 20:40:05 +0200
From:      Miroslav Lachman <000.fbsd@quip.cz>
To:        Matthew Seaman <matthew@FreeBSD.org>, freebsd-ports@freebsd.org
Subject:   Re: How to use @preexec to test for installed packages
Message-ID:  <b715280f-e177-95fe-4b52-36ebf618c98c@quip.cz>
In-Reply-To: <94efa3ed-ec50-f29a-b0a3-d174ba2d496c@FreeBSD.org>
References:  <16553fab-03af-9942-93e2-7ebb116487a9@fechner.net> <94efa3ed-ec50-f29a-b0a3-d174ba2d496c@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Seaman wrote on 2019/04/06 19:00:
> On 06/04/2019 14:58, Matthias Fechner wrote:
> 
>> as pkg cannot handle CONFLICTS_INSTALL I tried now to implement this as
>> a preinstall command using @preexec in pkg-plist.
>>
>> The command should check if a package is installed and stop the
>> installation or continue if the package is not installed.
>>
>> I tried it with the following command:
>> @preexec `/usr/sbin/pkg -N info -e gogs`; if [ $? -eq 0 ]; then echo
>> "Gitlab cannot be installed together with gogs as both of them modify
>> .ssh/authorized_keys" && exit 1; else echo "Gogs not installed,
>> continue."; fi
>>
>> But it does not work.
>> Now matter if gogs is installed or not.
>> If I execute the same line in a shell script, it works fine.
>>
>> Anyone an idea?
> 
> pkg(8) does handle the most common reason for packages conflicting at
> install time -- file name clashes.  Indeed, it does this automatically
> with no need of input from porters or maintainers, although it is usual
> to add CONFLICTS_INSTALL lines to port Makefiles to document clashes
> discovered this way.
> 
> However, where there are other reasons for packages to conflict at
> install time, then you are correct that pkg doesn't handle this.
> There's simply no mechanism to include information about package
> conflicts into pkg metadata.

Then you can add some fake (empty) file to the plist of package A which 
will conflict with package B and then pkg conflict will work as expected.
But I am not sure we should prevent installation of some package just 
because it uses authorized_keys too.

Miroslav Lachman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b715280f-e177-95fe-4b52-36ebf618c98c>