View | Details | Raw Unified | Return to bug 160896 | Differences between
and this patch

Collapse All | Expand All

(-)tools/tools/nanobsd/nanobsd.sh (-62 / +81 lines)
Lines 58-64 Link Here
58
#NANO_DISKIMGDIR=""
58
#NANO_DISKIMGDIR=""
59
59
60
# Parallel Make
60
# Parallel Make
61
NANO_PMAKE="make -j 3"
61
NANO_PMAKE="make"
62
62
63
# The default name for any image we create.
63
# The default name for any image we create.
64
NANO_IMGNAME="_.disk.full"
64
NANO_IMGNAME="_.disk.full"
Lines 300-323 Link Here
300
run_customize() (
300
run_customize() (
301
301
302
	pprint 2 "run customize scripts"
302
	pprint 2 "run customize scripts"
303
	for c in $NANO_CUSTOMIZE
303
	set -- $NANO_CUSTOMIZE
304
	i=0
305
	num_steps=$#
306
	while [ $i -lt $num_steps ]
304
	do
307
	do
305
		pprint 2 "customize \"$c\""
308
		c=$1
309
		pprint 2 "[$i/$num_steps] customize \"$c\""
306
		pprint 3 "log: ${NANO_OBJ}/_.cust.$c"
310
		pprint 3 "log: ${NANO_OBJ}/_.cust.$c"
307
		pprint 4 "`type $c`"
311
		pprint 4 "`type $c`"
308
		( set -x ; $c ) > ${NANO_OBJ}/_.cust.$c 2>&1
312
		( set -x ; $c ) > ${NANO_OBJ}/_.cust.$c 2>&1
313
		shift
314
		: $(( i += 1 ))
309
	done
315
	done
310
)
316
)
311
317
312
run_late_customize() (
318
run_late_customize() (
313
319
314
	pprint 2 "run late customize scripts"
320
	pprint 2 "run late customize scripts"
315
	for c in $NANO_LATE_CUSTOMIZE
321
	set -- $NANO_LATE_CUSTOMIZE
322
	i=0
323
	num_steps=$#
324
	while [ $i -lt $num_steps ]
316
	do
325
	do
317
		pprint 2 "late customize \"$c\""
326
		pprint 2 "[$i/$num_steps] late customize \"$c\""
318
		pprint 3 "log: ${NANO_OBJ}/_.late_cust.$c"
327
		pprint 3 "log: ${NANO_OBJ}/_.late_cust.$c"
319
		pprint 4 "`type $c`"
328
		pprint 4 "`type $c`"
320
		( set -x ; $c ) > ${NANO_OBJ}/_.late_cust.$c 2>&1
329
		( set -x ; $c ) > ${NANO_OBJ}/_.late_cust.$c 2>&1
330
		shift
331
		: $(( i += 1 ))
321
	done
332
	done
322
)
333
)
323
334
Lines 588-593 Link Here
588
	# after the build completed, for instance to copy the finished
599
	# after the build completed, for instance to copy the finished
589
	# image to a more convenient place:
600
	# image to a more convenient place:
590
	# cp ${NANO_DISKIMGDIR}/_.disk.image /home/ftp/pub/nanobsd.disk
601
	# cp ${NANO_DISKIMGDIR}/_.disk.image /home/ftp/pub/nanobsd.disk
602
	# The following line is needed to keep bash from barfing on the file.
603
	:
591
)
604
)
592
605
593
#######################################################################
606
#######################################################################
Lines 758-859 Link Here
758
# Progress Print
771
# Progress Print
759
#	Print $2 at level $1.
772
#	Print $2 at level $1.
760
pprint() {
773
pprint() {
761
    if [ "$1" -le $PPLEVEL ]; then
774
	if [ "$1" -le $PPLEVEL ]; then
762
	runtime=$(( `date +%s` - $NANO_STARTTIME ))
775
		runtime=$(( $(date +'%s') - ${NANO_STARTTIME} ))
763
	printf "%s %.${1}s %s\n" "`date -u -r $runtime +%H:%M:%S`" "#####" "$2" 1>&3
776
		printf "%s %.${1}s %s\n" "$(date -u -r $runtime +%H:%M:%S)" "#####" "$2" >&3
764
    fi
777
	fi
765
}
778
}
766
779
767
usage () {
780
usage () {
768
	(
781
	cat >&2 <<EOF
769
	echo "Usage: $0 [-bfiknqvw] [-c config_file]"
782
usage: ${0##*/} [-biknqvw] [-c config_file]
770
	echo "	-b	suppress builds (both kernel and world)"
783
	-b		suppress builds (both kernel and world)
771
	echo "	-f	suppress code slice extraction"
784
	-c config_file	config file to use after defining all
772
	echo "	-i	suppress disk image build"
785
			internal variables.
773
	echo "	-k	suppress buildkernel"
786
	-i		suppress disk image build
774
	echo "	-n	add -DNO_CLEAN to buildworld, buildkernel, etc"
787
	-j make-jobs	number of make jobs to invoke
775
	echo "	-q	make output more quiet"
788
	-k		suppress buildkernel
776
	echo "	-v	make output more verbose"
789
	-n		add -DNO_CLEAN to buildworld, buildkernel, etc
777
	echo "	-w	suppress buildworld"
790
	-q		make output more quiet
778
	echo "	-c	specify config file"
791
	-v		make output more verbose
779
	) 1>&2
792
	-w		suppress buildworld
793
EOF
780
	exit 2
794
	exit 2
781
}
795
}
782
796
783
#######################################################################
797
#######################################################################
784
# Parse arguments
798
# Parse arguments
785
799
800
set +e
801
786
do_clean=true
802
do_clean=true
787
do_kernel=true
803
do_kernel=true
788
do_world=true
804
do_world=true
789
do_image=true
805
do_image=true
790
do_copyout_partition=true
806
do_copyout_partition=true
807
make_jobs=3
808
nano_confs=
791
809
792
set +e
810
while getopts 'bc:hij:knqvw' optch
793
args=`getopt bc:fhiknqvw $*`
794
if [ $? -ne 0 ] ; then
795
	usage
796
	exit 2
797
fi
798
set -e
799
800
set -- $args
801
for i
802
do
811
do
803
	case "$i" 
812
	case "$optch" in
804
	in
813
	b)
805
	-b)
806
		do_world=false
814
		do_world=false
807
		do_kernel=false
815
		do_kernel=false
808
		shift
809
		;;
816
		;;
810
	-k)
817
	c)
811
		do_kernel=false
818
		if [ -f "$OPTARG" ]; then
812
		shift
819
			nano_confs="$nano_confs $OPTARG"
820
		fi
813
		;;
821
		;;
814
	-c)
822
	f)
815
		. "$2"
816
		shift
817
		shift
818
		;;
819
	-f)
820
		do_copyout_partition=false
823
		do_copyout_partition=false
821
		shift
822
		;;
824
		;;
823
	-h)
825
	h)
824
		usage
826
		usage
825
		;;
827
		;;
826
	-i)
828
	i)
827
		do_image=false
829
		do_image=false
828
		shift
829
		;;
830
		;;
830
	-n)
831
	j)
832
		echo $OPTARG | egrep -q '^[[:digit:]]+$' && [ $OPTARG -gt 0 ]
833
		if [ $? -ne 0 ]; then
834
			echo "${0##*/}: -j value must be a positive integer."
835
			usage
836
		fi
837
		make_jobs=$OPTARG
838
		;;
839
	k)
840
		do_kernel=false
841
		;;
842
	n)
831
		do_clean=false
843
		do_clean=false
832
		shift
833
		;;
844
		;;
834
	-q)
845
	q)
835
		PPLEVEL=$(($PPLEVEL - 1))
846
		: $(( PPLEVEL -= 1))
836
		shift
837
		;;
847
		;;
838
	-v)
848
	v)
839
		PPLEVEL=$(($PPLEVEL + 1))
849
		: $(( PPLEVEL += 1))
840
		shift
841
		;;
850
		;;
842
	-w)
851
	w)
843
		do_world=false
852
		do_world=false
844
		shift
845
		;;
853
		;;
846
	--)
854
	*)
847
		shift
855
		usage
848
		break
856
		;;
849
	esac
857
	esac
850
done
858
done
851
859
860
shift $(( $OPTIND - 1 ))
861
852
if [ $# -gt 0 ] ; then
862
if [ $# -gt 0 ] ; then
853
	echo "$0: Extraneous arguments supplied"
863
	echo "${0##*/}: extraneous arguments supplied"
854
	usage
864
	usage
855
fi
865
fi
856
866
867
NANO_PMAKE="$NANO_PMAKE -j $make_jobs"
868
869
set -e
870
857
#######################################################################
871
#######################################################################
858
# Setup and Export Internal variables
872
# Setup and Export Internal variables
859
#
873
#
Lines 865-870 Link Here
865
NANO_MAKE_CONF_BUILD=${MAKEOBJDIRPREFIX}/make.conf.build
879
NANO_MAKE_CONF_BUILD=${MAKEOBJDIRPREFIX}/make.conf.build
866
NANO_MAKE_CONF_INSTALL=${NANO_OBJ}/make.conf.install
880
NANO_MAKE_CONF_INSTALL=${NANO_OBJ}/make.conf.install
867
881
882
for nano_conf in $nano_confs; do
883
	echo "Sourcing $nano_conf"
884
	. "$nano_conf"
885
done
886
868
if [ -d ${NANO_TOOLS} ] ; then
887
if [ -d ${NANO_TOOLS} ] ; then
869
	true
888
	true
870
elif [ -d ${NANO_SRC}/${NANO_TOOLS} ] ; then
889
elif [ -d ${NANO_SRC}/${NANO_TOOLS} ] ; then

Return to bug 160896