keeping all things up to date

Kevin Kinsey kdk at daleco.biz
Tue Apr 17 23:06:45 UTC 2007


Chad Perrin wrote:

> If you have specific ideas about what parts of the updating process are
> "safe", you might try writing a few shell or Perl scripts that automate
> those steps -- then share them with the rest of the world.  You might
> also, if writing such scripts is too far outside your expertise, simply
> put together a carefully crafted list of steps you think should be taken
> so you can pass it on to others like myself who might be more likely to
> write the code (at which point I/he/she can give it back to you for your
> own use).

This is possible - perhaps even trivial.  Of course, when something breaks,
you're off to get a console, whether it's the next office over or a thousand
miles away.

Attached is a modified version of what I use on some of our machines, for OS
only, if anyone wants a "starting point".  It's part of a "larger system" I'll
probably never finish.  It's pretty simple, amateurish even ... no tests, etc.
Since we know it works for us, didn't figure it was needed.

YMMV, BSD license, include #<disclaimer.h>, etc.

Kevin Kinsey
-- 
You can observe a lot just by watching.
		-- Yogi Berra
-------------- next part --------------
#! /bin/sh

#DEFINE THE FOLLOWING:
  #Csup program
    CSUP="/usr/local/bin/cvsup"
  #Kernel file
    $KERNFILE="$SRCTREE/sys/i386/conf/GENERIC"
  #Log Directory
    LOGDIR="~/buildlogs"
  #Admin's mail address
    MAIL2="me at mydomain.com"
  #path to source tree
    SRCTREE="/usr/src"
  #source supfile
    SRC_SUPFILE="/stable-supfile"
  #temp dir
    TMPD="$TMPD"

# More defines
    HOST=`hostname`
    SCRIPT=`realpath $0`
    SCRIPTDIR=`realpath .`
    $MSG="updatemsg.txt"

    echo "$HOST successfully built
a GENERIC kernel plus Firewall,
Divert and Dummynet options. " > $SCRIPTDIR/updatemsg.txt

 # Get to proper wd and update the source tree
    cd $SRCTREE; $CSUP $SRC_SUPFILE > $LOGDIR/src.cvsup 2>&1
 #report and clean up
    echo "$HOST cvsup script reporting" > $TMPD/buildlogfoo
    echo "\n" >> $TMPD/buildlogfoo
    tail $LOGDIR/src.cvsup >> $TMPD/buildlogfoo
    cat $TMPD/buildlogfoo | mail -s "Server Report $HOST CVSup" $MAIL2
    rm $TMPD/buildlogfoo
 
 # Next step: build the world
    make buildworld > $LOGDIR/buildworld 2>&1
 
 # report and clean up
    echo "$HOST buildworld script reporting" > $TMPD/buildlogfoo
    echo "\n" >> $TMPD/buildlogfoo
    tail $LOGDIR/buildworld >> $TMPD/buildlogfoo
    cat $TMPD/buildlogfoo | mail -s "Server Report $HOST Buildworld" $MAIL2
    rm $TMPD/buildlogfoo
 
 # Set up kernel options for Firewall, Nat, Dummynet
    echo " " >> $KERNFILE
    echo "# added by $SCRIPT " >> $KERNFILE
    echo " " >> $KERNFILE
    echo "options   IPFIREWALL" >> $KERNFILE
    echo "options   IPFIREWALL_VERBOSE_LIMIT=10" >> $KERNFILE
    echo "options   IPDIVERT" >> $KERNFILE
    echo "options   DUMMYNET" >> $KERNFILE
    echo "options   HZ=1000" >> $KERNFILE
    echo " " >> $KERNFILE
  
 # Build the kernel
    make buildkernel > $LOGDIR/kernel 2>&1
    tail $LOGDIR/kernel > $TMPD/kernelfoobuild
    cat $SCRIPTDIR/$MSG $TMPD/kernelfoobuild | mail -s "$HOST Kernel  Build Report" $MAIL2
    rm $TMPD/kernelfoobuild
 
 # Install the new kernel
    make installkernel > $LOGDIR/kern.inst 2>&1
    echo "Report on kernel installation from $HOST" >>  $TMPD/kernelinstallfoo
    cat $TMPD/kernelinstallfoo $LOGDIR/kern.inst | mail -s "$HOST kernel  install report" $MAIL2
    rm $TMPD/kernelinstallfoo 
 
 exit 0;


More information about the freebsd-questions mailing list