close Warning: Can't use blame annotator:
No changeset 7067 in the repository

source: hybrid/branches/releng-10/nanobsd/tools/rsync-image.sh@ 13423

Last change on this file since 13423 was 13423, checked in by rick, 9 years ago

Using unbound from ports allows clear design.

The local_unbound scripts are really messy and not tailored towards our needs,
moving to the port version which is less intrusive and does not try to be 'smart'.

While here include dnsmasq and nsd (again) allowing us to toy around with autoritive nameservers.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 984 bytes
RevLine 
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.