From 239dc05c4f00af1d6dcce2f6146ca203dc7bf31f Mon Sep 17 00:00:00 2001 From: lukem Date: Sun, 8 Dec 2002 22:14:00 +0000 Subject: [PATCH] Add -E - "expert mode". If this is not specified, builds to DESTDIR=/ are not permitted. By using this flag, you are taking responsibility for any issues that may occur because of this... --- BUILDING | 3 +++ build.sh | 22 ++++++++++++++++------ doc/BUILDING.mdoc | 9 ++++++++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/BUILDING b/BUILDING index a499d2291c83..aac56ec38ea6 100644 --- a/BUILDING +++ b/BUILDING @@ -451,6 +451,9 @@ BUILDING /var. Note this does not build a ``release''; no release sets are placed in ${RELEASEDIR}. -d is implied by -R. + -E Set `expert' mode; DESTDIR does not have to be set to a non- + root path for builds when this is set. + -j njob Passed through to make(1). Makefiles should use .WAIT or have explicit dependancies as necessary to enforce build ordering. If you see build failures with -j, please save complete build diff --git a/build.sh b/build.sh index 193f3a432498..010eafcbd71e 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #! /usr/bin/env sh -# $NetBSD: build.sh,v 1.73 2002/12/08 08:42:51 lukem Exp $ +# $NetBSD: build.sh,v 1.74 2002/12/08 22:14:00 lukem Exp $ # # Top level build wrapper, for a system containing no tools. # @@ -104,7 +104,7 @@ resolvepath () { usage () { cat <<_usage_ Usage: -`basename $0` [-bdnortUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-k kernel] +`basename $0` [-bdEnortUu] [-a arch] [-B buildid] [-D dest] [-j njob] [-k kernel] [-M obj] [-m mach] [-O obj] [-R release] [-T tools] [-w wrapper] -a arch set MACHINE_ARCH to arch (otherwise deduced from MACHINE) @@ -112,6 +112,7 @@ Usage: -b build nbmake and nbmake wrapper script, if needed -D dest set DESTDIR to dest -d build a full distribution into DESTDIR (including etc files) + -E set "expert" mode; disables some DESTDIR checks -j njob run up to njob jobs in parallel; see make(1) -k kernel build a kernel using the named configuration file -M obj set obj root directory to obj (sets MAKEOBJDIRPREFIX) @@ -142,10 +143,11 @@ do_buildkernel=false do_buildtools=false do_rebuildmake=false do_removedirs=false +expert_mode=false makeenv= makewrapper= opt_a=no -opts='a:B:bD:dhj:k:M:m:nO:oR:rT:tUuw:' +opts='a:B:bD:dEhj:k:M:m:nO:oR:rT:tUuw:' runcmd= if type getopts >/dev/null 2>&1; then @@ -180,6 +182,8 @@ while eval $getoptcmd; do case $opt in -d) buildtarget=distribution;; + -E) expert_mode=true;; + -j) eval $optargcmd parallel="-j $OPTARG";; @@ -362,8 +366,14 @@ if [ -z "$DESTDIR" ] || [ "$DESTDIR" = "/" ]; then [ "`uname -m`" != "$MACHINE" ]; then bomb "DESTDIR must be set to a non-root path for cross builds or -d or -R." fi - $runcmd echo "===> WARNING: Building to /." - $runcmd echo "===> If your kernel is not up to date, this may cause the system to break!" + if ! $expert_mode; then + bomb "DESTDIR must be set to a non-root path for non -E (expert) builds" + fi + $runcmd echo "===> WARNING: Building to /, in expert mode." + $runcmd echo "===> This may cause your system to break, including if" + $runcmd echo "===> - your kernel is not up to date" + $runcmd echo "===> - the libraries or toolchain have changed" + $runcmd echo "===> YOU HAVE BEEN WARNED!" fi else removedirs="$removedirs $DESTDIR" @@ -409,7 +419,7 @@ fi eval cat <