From 4b071d966b60272d19f1016f164b42704ae6b90c Mon Sep 17 00:00:00 2001 From: tnn Date: Thu, 10 May 2007 02:55:31 +0000 Subject: Get PKGSRCDIR from mk.conf. In turn, Get path of mk.conf from MAKECONF or default to /etc/mk.conf if unset. Bump PKGREVISON. --- pkgtools/pkg_rolling-replace/Makefile | 4 ++-- .../pkg_rolling-replace/files/pkg_rolling-replace.8 | 14 +++++++++++--- .../pkg_rolling-replace/files/pkg_rolling-replace.sh | 17 ++++++++++------- 3 files changed, 23 insertions(+), 12 deletions(-) (limited to 'pkgtools') diff --git a/pkgtools/pkg_rolling-replace/Makefile b/pkgtools/pkg_rolling-replace/Makefile index 1848e78d5a9..a5e4a128b16 100644 --- a/pkgtools/pkg_rolling-replace/Makefile +++ b/pkgtools/pkg_rolling-replace/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.4 2007/01/07 09:14:08 rillig Exp $ +# $NetBSD: Makefile,v 1.5 2007/05/10 02:55:31 tnn Exp $ DISTNAME= pkg_rolling-replace-0.04 -PKGREVISION= 3 +PKGREVISION= 4 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 index 4f6c7fd0e25..003d2062b51 100644 --- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 +++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_rolling-replace.8,v 1.2 2006/12/06 10:41:29 wiz Exp $ +.\" $NetBSD: pkg_rolling-replace.8,v 1.3 2007/05/10 02:55:31 tnn Exp $ .Dd August 7, 2006 .Dt PKG_ROLLING-REPLACE 8 .Os @@ -86,10 +86,18 @@ is given (does not exclude unsafe or rebuild-requested packages). .Nm uses the following environment variables. .Bl -tag -width xxxx +.It Ev MAKECONF +Path to +.Pa mk.conf . +Defaults to +.Pa /etc/mk.conf +with a fallback to +.Pa /usr/pkgsrc/etc/mk.conf . .It Ev PKGSRCDIR Base of pkgsrc tree. -Defaults to -.Pa /usr/pkgsrc . +Defaults to value configured in MAKECONF or +.Pa /usr/pkgsrc +if unset. .It Ev PKG_DBDIR pkgsrc database directory. If not set in environment then defaults to diff --git a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh index a963c575447..11189ee9931 100755 --- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh +++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $NetBSD: pkg_rolling-replace.sh,v 1.2 2006/12/18 12:36:17 gdt Exp $ +# $NetBSD: pkg_rolling-replace.sh,v 1.3 2007/05/10 02:55:31 tnn Exp $ # # Copyright (c) 2006 BBN Technologies Corp. All rights reserved. # @@ -60,16 +60,19 @@ # of foo pulls in foo-share which conflicts with foo. This needlessly # loses. # -# Parse mk.conf for PKGSRCDIR, etc. - -test -n "$PKG_DBDIR" || PKG_DBDIR=/var/db/pkg -test -n "$PKGSRCDIR" || PKGSRCDIR=/usr/pkgsrc - -unset PKG_PATH || true #or pkgsrc makefiles will complain # Substituted by pkgsrc at pre-configure time. MAKE=@MAKE@ +test -z "$PKG_DBDIR" && PKG_DBDIR=/var/db/pkg +test -z "$MAKECONF" && M=/etc/mk.conf && test -f $M && MAKECONF=$M +test -z "$MAKECONF" && M=/usr/pkg/etc/mk.conf && test -f $M && MAKECONF=$M +test -z "$PKGSRCDIR" && test -f "$MAKECONF" && \ + PKGSRCDIR="`$MAKE -f \"$MAKECONF\" BSD_PKG_MK=1 -V PKGSRCDIR`" +test -z "$PKGSRCDIR" && PKGSRCDIR=/usr/pkgsrc + +unset PKG_PATH || true #or pkgsrc makefiles will complain + usage() { echo "Usage: pkg_rolling-replace [opts] -- cgit v1.2.3