source: hybrid/branches/releng-9.0/nanobsd/tools/config-image.sh@ 10441

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

The pf_flags are not always included causing the external definitions like
-Dif=foo not to be included, yielding false errors in the config files.

The needs to become an send-pr(1) patch, or otherwise reported (also not fixed
in CURRENT/HEAD yet).

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 1016 bytes
Line 
1#!/bin/sh
2# Push config onto persistent location inside node image
3#
4# XXX: Error handing
5. $(dirname $0)/package-build.inc.sh
6
7BASEDIR=`dirname $0`
8if [ -n "$1" ]; then
9 IMG=$1
10else
11 CFG="${BASEDIR}/../cfg/nanobsd.wleiden"
12
13 # Find object directory
14 eval `grep '^NANO_NAME=' ${CFG}`
15 OBJDIR="/usr/obj/nanobsd.${NANO_NAME}"
16 IMG=${OBJDIR}/_.disk.full
17fi
18
19if [ ! -r "${IMG}" ]; then
20 p_err Source ${IMG} does not exists
21fi
22
23# Make sure we are root from this point on
24f_check_root
25
26
27MNT=`mktemp -d -t $(basename $0)`
28
29# If target nfs image is mounted somehow, bail out
30if mdconfig -l -v | grep -q "${IMG}"; then
31 MD=`mdconfig -l -v | grep "${IMG}" | cut -c -4`
32 p_err "'${IMG}' already mounted at '$MD'"
33 exit 1
34fi
35
36
37MD=`mdconfig -a -t vnode -f ${IMG}`
38mount /dev/${MD}s1a ${MNT}
39
40# Config files lives at /cfg location
41mount /dev/${MD}s3 ${MNT}/cfg
42
43# Try to fetch and store config
44chroot ${MNT} /tools/wl-config -n -m startup
45
46# Clean up
47umount ${MNT}/cfg
48umount ${MNT}
49mdconfig -d -u ${MD}
50rm -d ${MNT}
51
52
Note: See TracBrowser for help on using the repository browser.