source: hybrid/branches/releng-9.0/nanobsd/tools/image-build.sh@ 10804

Last change on this file since 10804 was 10407, checked in by rick, 13 years ago

Nice hack to publish the /var/db/pkg into /usr/local/var/db/pkg. Allowing it to store on permanent location.

Related-To: nodefactory#109

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/sh
2# Wrapper around nanobsd.sh with autodetection of already processed steps
3# to provide some failsafe net
4
5BASEDIR=`dirname $0`
6. ${BASEDIR}/package-build.inc.sh
7
8NANOBSD="$NANO_SRC/tools/tools/nanobsd/nanobsd.sh"
9
10FORCE_KERNEL=0
11FORCE_WORLD=0
12#XXX: Proper object handling
13if [ "$1" = "-bk" ]; then
14 p_warn Forcefully building kernel
15 FORCE_KERNEL=1
16elif [ "$1" = "-bw" ]; then
17 p_warn Forcefully building world
18 FORCE_WORLD=1
19elif [ "$1" = "-f" ]; then
20 p_warn Forcefully building world and kernel
21 FORCE_KERNEL=1
22 FORCE_WORLD=1
23fi
24shift
25NANOBSD_EXTRA=$*
26
27if [ ! -r "${NANOBSD}" ]; then
28 p_err ${NANOBSD} does not exists
29 exit 1
30fi
31
32if [ ! -x "${NANOBSD}" ]; then
33 NANOBSD="sh ${NANOBSD}"
34fi
35
36# Find object directory
37OBJDIR="/usr/obj/nanobsd.${NANO_NAME}"
38
39if [ -d "${OBJDIR}" ]; then
40 NANOBSD_FLAGS=""
41
42 # Detect succesfull buildworld
43 tail -10 ${OBJDIR}/_.bw | grep 'World build completed'
44 if [ $? -eq 0 -a ${FORCE_WORLD} -eq 0 ]; then
45 p_info NO building of world, use $0 -f to force
46 NANOBSD_FLAGS="${NANOBSD_FLAGS} -w"
47 fi
48
49 # Detect succesfull buildkernel
50 tail -10 ${OBJDIR}/_.bk | grep 'Kernel build for .* completed'
51 if [ $? -eq 0 -a ${FORCE_KERNEL} -eq 0 ]; then
52 p_info NO building of kernel, use $0 -f to force
53 NANOBSD_FLAGS="${NANOBSD_FLAGS} -k"
54 fi
55
56else
57 p_warn Nothing yet, starting fresh
58 NANOBSD_FLAGS=""
59fi
60
61# Provide verbose output by default
62COMMAND="${NANOBSD} ${NANOBSD_FLAGS} -c ${NANO_CFG_FILE} -v ${NANOBSD_EXTRA}"
63f_time ${COMMAND}
64RETVAL=$?
65
66# Verify on build failures
67tail -10 ${OBJDIR}/_.bw | grep 'World build completed'
68if [ $? -eq 1 ]; then
69 p_err Building world FAILED, check ${OBJDIR}/_.bw
70fi
71tail -10 ${OBJDIR}/_.bk | grep 'Kernel build for .* completed'
72if [ $? -eq 1 ]; then
73 p_err Building kernel FAILED, check ${OBJDIR}/_.bk
74fi
75if [ $RETVAL -ne 0 ]; then
76 p_err "Errors in building NanoBSD Image ($RETVAL)"
77fi
78p_info End time: `date`
79exit ${RETVAL}
Note: See TracBrowser for help on using the repository browser.