source: hybrid/trunk/nanobsd/tools/edit-image.sh@ 10119

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

vpn, node, proxy and future other stuff

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 924 bytes
Line 
1#!/bin/sh
2# Chroot into image to edit bits and pieces
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 IMG=${OBJDIR}/_.disk.full
12fi
13
14if [ ! -r "${IMG}" ]; then
15 p_err Source ${IMG} does not exists
16 exit 1
17fi
18
19# Make sure we are root from this point on
20f_check_root
21
22
23MNT=`mktemp -d -t $(basename $0)`
24
25# If target nfs image is mounted somehow, bail out
26if mdconfig -l -v | grep -q "${IMG}"; then
27 MD=`mdconfig -l -v | grep "${IMG}" | cut -c -4`
28 print_error "'${IMG}' already mounted at '$MD'"
29 exit 1
30fi
31
32
33MD=`mdconfig -a -t vnode -f ${IMG}`
34mount /dev/${MD}s1a ${MNT}
35
36# Config files lives at /cfg location
37mount /dev/${MD}s3 ${MNT}/cfg
38
39# Try to fetch and store config
40p_info "Type exit when done"
41chroot ${MNT}
42p_info "Any changes are made permanent on image ${IMG}"
43
44# Clean up
45umount ${MNT}/cfg
46umount ${MNT}
47mdconfig -d -u ${MD}
48rm -d ${MNT}
49
50
Note: See TracBrowser for help on using the repository browser.