New /bin/sh based script to manage ports

Doug Barton dougb at
Sat Jan 7 02:27:51 PST 2006

KOMATSU Shinichiro wrote:

> PORTSDIR is set in, which is not included
> if you do not explicitly include it by ".include <>".
> Don't you set it in /etc/make.conf or environment variable?
> Recently I thought the same problem, and
> the best solution I came up with till now is
> running the following command:
>     % echo '.include <>' | make -f - -V PORTSDIR

Actually Sam Lawrance was kind enough to point out that that you can simply 
do 'make -V VAR' even without a Makefile. I had tried this approach, but was 
discouraged when I didn't get a value back. After Sam's encouragement 
though, it dawned on me that a value would appear using this method if there 
was one set in /etc/make.conf. I tested this method, and incorporated it in 
a new version of portmaster which I just uploaded to my web site.

KOMATSU-san, you might want to be aware that on RELENG_4 doing 'make -V VAR' 
without a Makefile, will print an error message. I handled it this way:

portsdir=`make -V PORTSDIR 2>/dev/null`
pkg_dbdir=`make -V PKG_DBDIR 2>/dev/null`
: ${portsdir:=/usr/ports}
: ${pkg_dbdir:=/var/db/pkg}



PS, thanks Sam!


     This .signature sanitized for your protection

More information about the freebsd-ports mailing list