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

Last change on this file since 10186 was 10186, checked in by richardvm, 13 years ago

no bridge needed and gateway is maanged by gformat

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