How to use @preexec to test for installed packages

Baptiste Daroussin bapt at FreeBSD.org
Fri Apr 19 12:47:20 UTC 2019


On Sat, Apr 06, 2019 at 03:58:48PM +0200, Matthias Fechner wrote:
> Dear all,
> 
> 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
> 
There is no reason at all to prevent gitlab to be installed along side with gogs
or even gitea because they both play with .ssh/authrized_keys.

It is up to the admin to be careful about it. As an admin I may want to be able
to install both to transition from one to another.

I can also have both on the same machine, but started with different users (I
already did that in the past with gitea and gogs and they both run fine
together.

My 2cts is admins should know what they are doing here and there is no reason to
register a conflict here. It is on purpose that pkg only check for conflicting
files, until now no cases justified yet any other case of conflict to be handled
by pkg. (If that ever happen then we will implement a conflict handling
solution).

Best regards,
Bapt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20190419/f55e99ef/attachment.sig>


More information about the freebsd-ports mailing list