From owner-freebsd-ports@freebsd.org Sat Apr 6 18:49:03 2019 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D30F7156915A for ; Sat, 6 Apr 2019 18:49:02 +0000 (UTC) (envelope-from SRS0=PvnO=SI=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 087448CF8E; Sat, 6 Apr 2019 18:49:02 +0000 (UTC) (envelope-from SRS0=PvnO=SI=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 43E3F28426; Sat, 6 Apr 2019 20:40:06 +0200 (CEST) Received: from illbsd.quip.test (ip-62-24-76-131.net.upcbroadband.cz [62.24.76.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 35A8828429; Sat, 6 Apr 2019 20:40:04 +0200 (CEST) Subject: Re: How to use @preexec to test for installed packages To: Matthew Seaman , freebsd-ports@freebsd.org References: <16553fab-03af-9942-93e2-7ebb116487a9@fechner.net> <94efa3ed-ec50-f29a-b0a3-d174ba2d496c@FreeBSD.org> From: Miroslav Lachman <000.fbsd@quip.cz> Message-ID: Date: Sat, 6 Apr 2019 20:40:05 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.3 MIME-Version: 1.0 In-Reply-To: <94efa3ed-ec50-f29a-b0a3-d174ba2d496c@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 087448CF8E X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [5.09 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.97)[0.972,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[quip.cz]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(0.93)[ip: (0.45), ipnet: 94.124.104.0/21(0.22), asn: 42000(3.89), country: CZ(0.08)]; MX_GOOD(-0.01)[cached: elsa.codelab.cz]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[4.105.124.94.list.dnswl.org : 127.0.10.0]; NEURAL_SPAM_LONG(1.00)[1.000,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=PvnO=SI=quip.cz=000.fbsd@elsa.codelab.cz]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=PvnO=SI=quip.cz=000.fbsd@elsa.codelab.cz]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Apr 2019 18:49:03 -0000 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