Last change
on this file since 13709 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:
955 bytes
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 | # Change password if image
|
---|
3 | #
|
---|
4 | # XXX: Error handing
|
---|
5 | . $(dirname $0)/common.inc.sh
|
---|
6 |
|
---|
7 | BASEDIR=`dirname $0`
|
---|
8 | if [ -n "$1" ]; then
|
---|
9 | IMG=$1
|
---|
10 | else
|
---|
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
|
---|
17 | fi
|
---|
18 |
|
---|
19 | if [ ! -r "${IMG}" ]; then
|
---|
20 | p_err Source ${IMG} does not exists
|
---|
21 | fi
|
---|
22 |
|
---|
23 | # Make sure we are root from this point on
|
---|
24 | f_check_root
|
---|
25 |
|
---|
26 |
|
---|
27 | MNT=`mktemp -d -t $(basename $0)`
|
---|
28 |
|
---|
29 | # If target nfs image is mounted somehow, bail out
|
---|
30 | if 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
|
---|
34 | fi
|
---|
35 |
|
---|
36 |
|
---|
37 | MD=`mdconfig -a -t vnode -f ${IMG}`
|
---|
38 | mount /dev/${MD}s1a ${MNT}
|
---|
39 |
|
---|
40 | # Config files lives at /cfg location
|
---|
41 | mount /dev/${MD}s3 ${MNT}/cfg
|
---|
42 |
|
---|
43 | # Try to fetch and store config
|
---|
44 | chroot ${MNT} passwd
|
---|
45 |
|
---|
46 | # Clean up
|
---|
47 | umount ${MNT}/cfg
|
---|
48 | umount ${MNT}
|
---|
49 | mdconfig -d -u ${MD}
|
---|
50 | rm -d ${MNT}
|
---|
51 |
|
---|
52 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.