source: hybrid/branches/releng-9.0/nanobsd/tools/rsync-image.sh@ 11480

Last change on this file since 11480 was 11480, checked in by rick, 12 years ago

New version of lvrouted is deployed everywhere, so might as well include in new image.

  • 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
6HOST=${1:-10.0.42.1}
7BASEDIR=`dirname $0`
8if [ -n "$2" ]; then
9 IMG=$2
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.image
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
27# Prepare image as filesystem
28MNT=`mktemp -d -t $(basename $0)`
29MD=`mdconfig -a -t vnode -f ${IMG}`
30mount /dev/${MD}a ${MNT} || exit 1
31
32# On error clean up nicely
33trap "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
37ssh $HOST mount -uwo noatime / || exit 1
38# Sync changes
39rsync -av --exclude=/dev --exclude=/etc --exclude=/var ${MNT}/ ${HOST}:/ || exit 1
40# Set to read-only mode again
41ssh $HOST mount -ur / || exit 1
42
43exit 0
Note: See TracBrowser for help on using the repository browser.