Subject: Re: Updating a stable machine without a local build
To: Chris Ross <cross+netbsd@distal.com>
From: Greg Troxel <gdt@ir.bbn.com>
List: netbsd-users
Date: 04/08/2005 09:13:04
Build release sets, as others have suggested.

On the target, you can install the kernel in place, and if not brave,
reboot.  (If you haven't moved that far, can do user and reboot and
get away with it.  If the new userland uses new syscalls, e.g. 2.0 to
2.99.15 and statvfs, you'll have trouble.  I do them both at once.)
Then, unpack the non-etc sets over the system with pax.

I have a huge script to do this and many other auto-admin things on my
project machines (build on beefy desktop, install on 20 notebooks,
most of which are 1.4 GHz 256 MB Thinkpad X31s).  Here is part of it:

## Update NetBSD
# The kernel is first so if we install new binaries that don't work
# with the running kernel, a reboot will work to fix.
KSETS="kern-SINEW"
SETS="base comp games man misc text"
XSETS="xbase xcomp xfont xserver"
SETSETC="etc xetc"
NETBSDETC=/usr/netbsd-etc

update-netbsd-kernel () {
    cd / && cp -p netbsd netbsd.pre-sinew
    cd / &&
    for set in $KSETS; do
	pax -rz -pe -f /sinew-staging/binary/sets/${set}.tgz
	# try to avoid filling up memory with softupdates
	sync; sync; sync;
    done
}

# Update netbsd installation
update-netbsd-base () {
    # extract regular sets on top of system
    cd / &&
    for set in $SETS $XSETS; do
	pax -rz -pe -f /sinew-staging/binary/sets/${set}.tgz
	# try to avoid filling up memory with softupdates
	sync; sync; sync;
    done
}

# A bit dangerous, since assumes ffsv1, and doesn't update mbr
update-netbsd-bootblocks () {
    DISKARG=$1
    DISK=${DISKARG:-/dev/rwd0a}
    cd /usr/mdec &&
    cp -p boot / &&
    installboot -v $DISK bootxx_ffsv1
}

update-netbsd-etc () {
    # extract etc sets for use by etcmanage
    rm -rf /usr/netbsd-etc
    mkdir -p ${NETBSDETC} && cd ${NETBSDETC} &&
    for set in $SETSETC; do
	pax -rz -pe < /sinew-staging/binary/sets/${set}.tgz
    done
    for i in 0 1 2 3 4 5 6 7 8 9; do
	echo "ETCMANAGE $i"
	etcmanage --up $NETBSDETC
    done
}

update-netbsd-dev () {
    (cd /dev && ./MAKEDEV all)
}

update-netbsd () { 
    update-netbsd-kernel
    update-netbsd-base
    #update-netbsd-bootblocks
    update-netbsd-etc
    update-netbsd-dev
}


You can get etcmanage:
http://www.ir.bbn.com/~gdt/etcmanage/index.html

It's sort of like etcupdate, but can be run hands-off.  Really I
should add some features from etcmanage to etcupdate (although
etcmanage works on other BSDs too).


-- 
        Greg Troxel <gdt@ir.bbn.com>