Date: Sat, 6 Apr 2019 12:59:19 -0600 From: Adam Weinberger <adamw@adamw.org> To: Miroslav Lachman <000.fbsd@quip.cz> Cc: Matthew Seaman <matthew@freebsd.org>, FreeBSD Ports <freebsd-ports@freebsd.org> Subject: Re: How to use @preexec to test for installed packages Message-ID: <CAP7rwch1Rnmk8jYnwpc%2Bt4fM7ct9rGkd22uih9L_YtyPne5jyg@mail.gmail.com> In-Reply-To: <b715280f-e177-95fe-4b52-36ebf618c98c@quip.cz> References: <16553fab-03af-9942-93e2-7ebb116487a9@fechner.net> <94efa3ed-ec50-f29a-b0a3-d174ba2d496c@FreeBSD.org> <b715280f-e177-95fe-4b52-36ebf618c98c@quip.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 6, 2019 at 12:49 PM Miroslav Lachman <000.fbsd@quip.cz> wrote: > > 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. Especially since www/gitea does the same thing (and probably a number of others as well). # Adam -- Adam Weinberger adamw@adamw.org https://www.adamw.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAP7rwch1Rnmk8jYnwpc%2Bt4fM7ct9rGkd22uih9L_YtyPne5jyg>