source: hybrid/branches/releng-11/nanobsd/tools/image-build.sh@ 14266

Last change on this file since 14266 was 13497, checked in by rick, 9 years ago

File renamed forgot the includes

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