3 # Copyright (c) 2005 Poul-Henning Kamp.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 nanobsd_sh=`realpath $0`
32 topdir=`dirname ${nanobsd_sh}`
33 . "${topdir}/defaults.sh"
35 #######################################################################
45 do_native_xtools=false
48 # Pull in legacy stuff for now automatically
49 . "${topdir}/legacy.sh"
52 args=`getopt BKXWbc:fhiIknqvw $*`
53 if [ $? -ne 0 ] ; then
66 do_installkernel=false
70 do_installkernel=false
87 # Make config file path available to the config file
88 # itself so that it can access additional files relative
89 # to its own location.
116 PPLEVEL=$(($PPLEVEL - 1))
120 PPLEVEL=$(($PPLEVEL + 1))
130 do_installworld=false
131 do_installkernel=false
142 if [ $# -gt 0 ] ; then
143 echo "$0: Extraneous arguments supplied"
147 #######################################################################
148 # And then it is as simple as that...
150 # File descriptor 3 is used for logging output, see pprint
152 set_defaults_and_export
154 if [ ! -d "${NANO_TOOLS}" ]; then
155 echo "NANO_TOOLS directory does not exist" 1>&2
160 NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN"
163 pprint 1 "NanoBSD image ${NANO_NAME} build starting"
171 pprint 2 "Using existing build tree (as instructed)"
176 pprint 2 "Skipping buildworld (as instructed)"
180 if ! $do_world ; then
185 pprint 2 "Skipping buildkernel (as instructed)"
188 if $do_installworld ; then
194 pprint 2 "Skipping installworld (as instructed)"
197 if ${do_native_xtools} ; then
200 if ${do_prep_image} ; then
203 if $do_installkernel ; then
206 pprint 2 "Skipping installkernel (as instructed)"
209 if $do_prep_image ; then
214 fixup_before_diskimage
216 pprint 2 "Skipping image prep (as instructed)"
219 calculate_partitioning
224 pprint 2 "Skipping image build (as instructed)"
227 pprint 2 "Skipping code and image build (as instructed)"
231 pprint 1 "NanoBSD image ${NANO_NAME} completed"