source: hybrid/branches/releng-9.0/nanobsd/tools/passwd-image.sh@ 10827

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

Make sure to load the wleiden.yaml from the proper location.

While here do cleanups at wl-config to make the path display more logical. Do
not show the fact that /usr/local/etc is symlinked to /etc/local. By doing so,
we make sure stuff will be more consistent.

Related-To: nodefactory:ticket:164

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 962 bytes
Line 
1#!/bin/sh
2# Change password if 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} passwd
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.