Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
sysupdate - an addition for etcupdate(8)
I wanted to update a few machines with latest netbsd-5 and -current today,
and found that there's a certain lack of tools to aid in the process:
we have etcupdate(8) and postinstall(8), but nothing to help extract the
userland sets (let alone do the same thing for the kernel, esp. now that
modules must be put into place, too).
To save me from re-typing the same commands, I've hacked a script
"sysupdate" that's intended to run with a new kernel booted, and which
will then 1) extract all the sets where mtree files are in /etc/mtree, and
2) run etcupdate for etc (and xetc, if in /etc/mtree).
Here's an example run:
% sh ~/tmp/sysupdate -s
/usr/cvs/src-current/obj.i386/releasedir/i386/binary/sets -n
---------------------------------------------------------------------------
Updating your userland now!
---------------------------------------------------------------------------
New userland: NetBSD 5.99.23 (GENERIC) #0: Sun Jan 3 02:13:00 CET 2010
Current kernel: NetBSD vmnetbsd6 5.99.23 NetBSD 5.99.23 (GENERIC) #0: Sun
Jan 3 02:13:00 CET 2010
feyrer%mini.local@localhost:/usr/cvs/src-current/obj.i386/sys/arch/i386/compile/GENERIC
i386
Really update? (y/N) y
Updating sets...
Extracting base.tgz
tar -plzx -C / -f base.tgz
Extracting comp.tgz
tar -plzx -C / -f comp.tgz
Extracting games.tgz
tar -plzx -C / -f games.tgz
Extracting man.tgz
tar -plzx -C / -f man.tgz
Extracting misc.tgz
tar -plzx -C / -f misc.tgz
Extracting modules.tgz
tar -plzx -C / -f modules.tgz
Extracting tests.tgz
tar -plzx -C / -f tests.tgz
Extracting text.tgz
tar -plzx -C / -f text.tgz
Extracting xbase.tgz
tar -plzx -C / -f xbase.tgz
Extracting xcomp.tgz
tar -plzx -C / -f xcomp.tgz
Extracting xfont.tgz
tar -plzx -C / -f xfont.tgz
Extracting xserver.tgz
tar -plzx -C / -f xserver.tgz
Updating etc files...
etcupdate -s
/usr/cvs/src-current/obj.i386/releasedir/i386/binary/sets/etc.tgz -s
/usr/cvs/src-current/obj.i386/releasedir/i386/binary/sets/xetc.tgz
Done.
%
The script is appended below. Enjoy!
- Hubert
#!/bin/sh
#
# Script to update userland sets (base, ... - whatever is i /usr/mtree)
# Also see if etc and xetc need an update. If so, run etcupdate.
#
# - Hubert Feyrer <hubert%feyrer.de@localhost>
#
etc_update=false
xetc_update=false
# Flag variables
setdir=`pwd`
do_NOT=
force=false
# Parse options
while getopts s:nf f
do
case $f in
s) setdir=${OPTARG};;
n) do_NOT=echo;;
f) force=true;;
*) echo "Usage: $0 [-nf] [-s tgzdir]"
echo "-n Do nothing"
echo "-f Force kernel version as ok"
echo "-s Directory with .tgz set files"
exit 1
;;
esac
done
shift `expr $OPTIND - 1`
if [ "$setdir" = "." ]; then
setdir=`pwd`
fi
echo
"---------------------------------------------------------------------------"
echo "Updating your userland now!"
echo
"---------------------------------------------------------------------------"
echo ""
echo New userland: `zcat ${setdir}/kern-GENERIC.tgz | strings | grep -a
'^NetBSD.*GENERIC'`
echo Current kernel: `uname -a`
echo ""
if ! $force
then
echo -n "Really update? (y/N) "
read yn
case $yn in
[yY]*) ;;
*) echo Aborting.
exit 1
;;
esac
fi
echo Updating sets...
cd /etc/mtree
for f in set.*
do
cd $setdir
set=${f##set.}
case ${set} in
etc)
etc_update=true
;;
xetc)
xetc_update=true
;;
*)
setfile=${set}.tgz
if [ -f ${setfile} ]; then
echo Extracting ${setfile}
$do_NOT tar -plzx -C / -f ${setfile}
else
echo WARNING: Set file ${setfile} not found, skipping.
fi
;;
esac
done
echo Updating etc files...
etcupdate_sets=""
if $etc_update; then
etcupdate_sets="-s ${setdir}/etc.tgz"
if $xetc_update; then
etcupdate_sets="${etcupdate_sets} -s ${setdir}/xetc.tgz"
fi
$do_NOT etcupdate ${etcupdate_sets}
fi
echo Done.
Home |
Main Index |
Thread Index |
Old Index