From owner-freebsd-bugs@FreeBSD.ORG Thu Sep 22 07:40:07 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2AAB1065670 for ; Thu, 22 Sep 2011 07:40:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7DE428FC13 for ; Thu, 22 Sep 2011 07:40:07 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p8M7e7X1063713 for ; Thu, 22 Sep 2011 07:40:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p8M7e7Ad063712; Thu, 22 Sep 2011 07:40:07 GMT (envelope-from gnats) Resent-Date: Thu, 22 Sep 2011 07:40:07 GMT Resent-Message-Id: <201109220740.p8M7e7Ad063712@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Garrett Cooper Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEE09106564A for ; Thu, 22 Sep 2011 07:33:55 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id DC7F58FC0C for ; Thu, 22 Sep 2011 07:33:55 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p8M7XthD001494 for ; Thu, 22 Sep 2011 07:33:55 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p8M7XtTu001459; Thu, 22 Sep 2011 07:33:55 GMT (envelope-from nobody) Message-Id: <201109220733.p8M7XtTu001459@red.freebsd.org> Date: Thu, 22 Sep 2011 07:33:55 GMT From: Garrett Cooper To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: conf/160896: [patch] use getopts, jobs option, delay -c usage improvements to nanobsd.sh X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 07:40:07 -0000 >Number: 160896 >Category: conf >Synopsis: [patch] use getopts, jobs option, delay -c usage improvements to nanobsd.sh >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 22 07:40:07 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Garrett Cooper >Release: 9.0-BETA2 >Organization: iXsystems, Inc. >Environment: FreeBSD bayonetta.local 9.0-BETA2 FreeBSD 9.0-BETA2 #0 r225653M: Tue Sep 20 08:36:49 PDT 2011 gcooper@bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA amd64 >Description: This patch does the following items: 1. Drops getopt in favor of getopts builtin handling. This is preferred as getopt is deprecated by POSIX. 2. Adds a -j option so that users can specify -j via the command line, which is passed to make. 3. Delays the sourcing of the nanobsd config_file so that users can depend on already on internal variables that are set later, like $NANO_MAKE_CONF_BUILD . This makes it possible for developers to depend on this file. These enhancements were based on some of the code present in the FreeNAS sourcebase. >How-To-Repeat: >Fix: Patch attached with submission follows: Index: tools/tools/nanobsd/nanobsd.sh =================================================================== --- tools/tools/nanobsd/nanobsd.sh (revision 225704) +++ tools/tools/nanobsd/nanobsd.sh (working copy) @@ -58,7 +58,7 @@ #NANO_DISKIMGDIR="" # Parallel Make -NANO_PMAKE="make -j 3" +NANO_PMAKE="make" # The default name for any image we create. NANO_IMGNAME="_.disk.full" @@ -588,6 +588,8 @@ # after the build completed, for instance to copy the finished # image to a more convenient place: # cp ${NANO_DISKIMGDIR}/_.disk.image /home/ftp/pub/nanobsd.disk + # The following line is needed to keep bash from barfing on the file. + : ) ####################################################################### @@ -758,102 +760,103 @@ # Progress Print # Print $2 at level $1. pprint() { - if [ "$1" -le $PPLEVEL ]; then - runtime=$(( `date +%s` - $NANO_STARTTIME )) - printf "%s %.${1}s %s\n" "`date -u -r $runtime +%H:%M:%S`" "#####" "$2" 1>&3 - fi + if [ "$1" -le $PPLEVEL ]; then + runtime=$(( $(date +'%s') - ${NANO_STARTTIME} )) + printf "%s %.${1}s %s\n" "$(date -u -r $runtime +%H:%M:%S)" "#####" "$2" >&3 + fi } usage () { - ( - echo "Usage: $0 [-bfiknqvw] [-c config_file]" - echo " -b suppress builds (both kernel and world)" - echo " -f suppress code slice extraction" - echo " -i suppress disk image build" - echo " -k suppress buildkernel" - echo " -n add -DNO_CLEAN to buildworld, buildkernel, etc" - echo " -q make output more quiet" - echo " -v make output more verbose" - echo " -w suppress buildworld" - echo " -c specify config file" - ) 1>&2 + cat >&2 <Release-Note: >Audit-Trail: >Unformatted: