Last change
on this file since 10407 was 10407, checked in by rick, 13 years ago |
Nice hack to publish the /var/db/pkg into /usr/local/var/db/pkg. Allowing it to store on permanent location.
Related-To: nodefactory#109
|
-
Property svn:eol-style
set to
LF
-
Property svn:executable
set to
*
|
File size:
984 bytes
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 | # Rsync minimal changes directly to live image
|
---|
3 |
|
---|
4 | . $(dirname $0)/package-build.inc.sh
|
---|
5 |
|
---|
6 | HOST=${1:-10.0.42.1}
|
---|
7 | BASEDIR=`dirname $0`
|
---|
8 | if [ -n "$2" ]; then
|
---|
9 | IMG=$2
|
---|
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.image
|
---|
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 | # Prepare image as filesystem
|
---|
28 | MNT=`mktemp -d -t $(basename $0)`
|
---|
29 | MD=`mdconfig -a -t vnode -f ${IMG}`
|
---|
30 | mount /dev/${MD}a ${MNT} || exit 1
|
---|
31 |
|
---|
32 | # On error clean up nicely
|
---|
33 | trap "cd /; umount ${MNT}; rmdir ${MNT}; mdconfig -d -u ${MD}" 0 1 2 3 15
|
---|
34 |
|
---|
35 | #XXX: Might want to do in one fly
|
---|
36 | # Set to write mode
|
---|
37 | ssh $HOST mount -uwo noatime / || exit 1
|
---|
38 | # Sync changes
|
---|
39 | rsync -av --exclude=/dev --exclude=/etc --exclude=/var ${MNT}/ ${HOST}:/ || exit 1
|
---|
40 | # Set to read-only mode again
|
---|
41 | ssh $HOST mount -ur / || exit 1
|
---|
42 |
|
---|
43 | exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.