Module Name:    src
Committed By:   apb
Date:           Mon Feb 10 08:20:05 UTC 2014

Modified Files:
        src: build.sh

Log Message:
Move the "-U or -E must be set for build as an unprivileged user."
test from sanitycheck() to validatemakeparams().  If MKUNPRIVED is set
in mk.conf (and not on the build.sh command line) then it's not yet
available for use in the sanitycheck function.

Also move some other code for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/build.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.274 src/build.sh:1.275
--- src/build.sh:1.274	Mon Jan 13 20:00:20 2014
+++ src/build.sh	Mon Feb 10 08:20:05 2014
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.274 2014/01/13 20:00:20 apb Exp $
+#	$NetBSD: build.sh,v 1.275 2014/02/10 08:20:05 apb Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1282,14 +1282,6 @@ parseoptions()
 #
 sanitycheck()
 {
-	# Non-root should always use either the -U or -E flag.
-	#
-	if ! ${do_expertmode} && \
-	    [ "$id_u" -ne 0 ] && \
-	    [ "${MKUNPRIVED:-no}" = "no" ] ; then
-		bomb "-U or -E must be set for build as an unprivileged user."
-	fi
-
 	# Install as non-root is a bad idea.
 	#
 	if ${do_install} && [ "$id_u" -ne 0 ] ; then
@@ -1515,6 +1507,22 @@ validatemakeparams()
 		statusmsg2 "MAKECONF file:" "${MAKECONF} (File not found)"
 	fi
 
+	# Normalise MKOBJDIRS, MKUNPRIVED, and MKUPDATE.
+	# These may be set as build.sh options or in "mk.conf".
+	# Don't export them as they're only used for tests in build.sh.
+	#
+	MKOBJDIRS=$(getmakevar MKOBJDIRS)
+	MKUNPRIVED=$(getmakevar MKUNPRIVED)
+	MKUPDATE=$(getmakevar MKUPDATE)
+
+	# Non-root should always use either the -U or -E flag.
+	#
+	if ! ${do_expertmode} && \
+	    [ "$id_u" -ne 0 ] && \
+	    [ "${MKUNPRIVED}" = "no" ] ; then
+		bomb "-U or -E must be set for build as an unprivileged user."
+	fi
+
 	if [ "${runcmd}" = "echo" ]; then
 		TOOLCHAIN_MISSING=no
 		EXTERNAL_TOOLCHAIN=""
@@ -1536,14 +1544,6 @@ validatemakeparams()
 		exit 1
 	fi
 
-	# Normalise MKOBJDIRS, MKUNPRIVED, and MKUPDATE
-	# These may be set as build.sh options or in "mk.conf".
-	# Don't export them as they're only used for tests in build.sh.
-	#
-	MKOBJDIRS=$(getmakevar MKOBJDIRS)
-	MKUNPRIVED=$(getmakevar MKUNPRIVED)
-	MKUPDATE=$(getmakevar MKUPDATE)
-
 	if [ "${MKOBJDIRS}" != "no" ]; then
 		# Create the top-level object directory.
 		#
@@ -1745,7 +1745,7 @@ createmakewrapper()
 	eval cat <<EOF ${makewrapout}
 #! ${HOST_SH}
 # Set proper variables to allow easy "make" building of a NetBSD subtree.
-# Generated from:  \$NetBSD: build.sh,v 1.274 2014/01/13 20:00:20 apb Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.275 2014/02/10 08:20:05 apb Exp $
 # with these arguments: ${_args}
 #
 

Reply via email to