On Dec 15, 2012, at 10:24 AM, Poul-Henning Kamp wrote:

> --------
> In message <[email protected]>, Garrett Cooper 
> wri
> tes:
> 
>>      If you have a ports tree, setting the appropriate variables and 
>> then running make check-already-installed is both forwards and backwards 
>> compatible.
> 
> Uhm, I'm not sure I understand how this would apply to sysbuild, which
> constructs an disk-image from scratch...

You're checking whether or not the package has been installed on the running 
system via `pkg info`. I discovered (after poking around bsd.port.mk a bit for 
other things) that `make check-already-installed` in the ports directory is an 
equivalent backwards compatible way of doing this (again, setting PORTSDIR, 
PKGDBDIR, etc to the right values). Example:

# for i in shells/bash shells/zsh; do (cd /usr/ports/$i; make 
check-already-installed; echo ec = $?); done
===>  Checking if shells/bash already installed
===>   bash-4.2.37 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of shells/bash
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1

Stop.
make: stopped in /usr/ports/shells/bash
ec = 1
===>  Checking if shells/zsh already installed
ec = 0

All you have to do is test for the exit code being non-zero (already installed) 
or zero (not installed). It's unfortunate that things are flip-flopped, but I 
understand the reason for it being that way in the make rules.

Also, your last commit snuck in a == instead of a = -- this breaks on older 
copies of /bin/sh .

HTH,
-Garrett

PS Just trying to help make sure things are backwards compatible because there 
are random people who have reported breakage issues in the past with various 
tools like nanobsd, picobsd, etc that aren't tied to a particular release.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to