Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Apr 2007 18:06:31 -0500
From:      Kevin Kinsey <kdk@daleco.biz>
To:        Michael Grant <mg-fbsd3@grant.org>
Cc:        Chad Perrin <perrin@apotheon.com>, FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: keeping all things up to date
Message-ID:  <462552F7.7000500@daleco.biz>
In-Reply-To: <20070417211241.GB48816@demeter.hydra>
References:  <62b856460704170112x7bae258dm5aede163b203a85b@mail.gmail.com>	<20070417091026.GA17020@demeter.hydra>	<14989d6e0704170249v486f3ad9vc5c8df53378229ca@mail.gmail.com>	<62b856460704170558i59cbe4c9m2b222af0e72af4ce@mail.gmail.com> <20070417211241.GB48816@demeter.hydra>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080103080307090808060307
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------080103080307090808060307
Content-Type: text/plain;
 name="worldupdate"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="worldupdate"

#! /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@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;

--------------080103080307090808060307--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?462552F7.7000500>