#!/bin/sh # $RedRiver: release.sh,v 1.4 2006/10/13 18:12:23 andrew Exp $ # Copyright (c) 2002 - 2006, FenderQ # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of FenderQ nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # -------------------------------------------- # OpenBSD - Release Building Shell Script v3.9 # # FenderQ.com - Internet Security Solutions # http://www.fenderq.com/ # # SEE ALSO release(8) # DEST="/usr/dest" RELEASE="/usr/release" CVSTAG=`uname -r | awk '{ sub("\\\.","_"); print "OPENBSD_" $0 }'` #SOURCES="src ports XF4" SOURCES="src ports" # Anonymous CVS - http://www.openbsd.org/anoncvs.html CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs" export CVSROOT install_sources() { echo "********** Install sources **********" cd /usr for d in $SOURCES; do rm -rf $d/* cvs -q -z6 checkout -r$CVSTAG -P $d done } update_sources() { echo "********** Update sources **********" for d in $SOURCES; do cd /usr && cvs -q -z6 update -r$CVSTAG -Pd $d done } build_kernel() { echo "********** Build and install a new kernel **********" cd /usr/src/sys/arch/i386/conf config GENERIC cd ../compile/GENERIC make clean depend && make cp /bsd /bsd.old && cp bsd / } build_system() { echo "********** Build a new system **********" rm -rf /usr/obj/* cd /usr/src && nice make obj cd /usr/src/etc && export DESTDIR=/ && make distrib-dirs cd /usr/src && nice make build } make_release() { echo "********** Make and validate the system release **********" cd /usr/src/distrib/crunch && make obj depend all install export DESTDIR=$DEST RELEASEDIR=$RELEASE rm -rf $DESTDIR/* mkdir -p $DESTDIR $RELEASEDIR cd /usr/src/etc && nice make release cd /usr/src/distrib/sets && sh checkflist unset DESTDIR RELEASEDIR } build_XF4() { echo "********** Build and install XF4 **********" rm -rf /usr/Xbuild mkdir -p /usr/Xbuild cd /usr/ports/lang/tcl/8.4 && make install cd /usr/ports/x11/tk/8.4 && make install cd /usr/Xbuild && lndir /usr/XF4 && nice make build } make_release_XF4() { echo "********** Make and validate the XF4 release **********" export DESTDIR=$DEST RELEASEDIR=$RELEASE rm -rf $DESTDIR mkdir -p $DESTDIR $RELEASEDIR nice make release unset DESTDIR RELEASEDIR } clean_everything() { echo "********** Clean everything **********" rm -rf /usr/obj/* $DEST /usr/Xbuild } usage() { echo "Usage: $0 options" echo echo "Options:" echo echo " install - Install sources" echo " update - Update sources" echo " kernel - Build and install a new kernel" echo " system - Build a new system" echo " release - Make and validate the system release" echo " xwindow - Build and install XF4" echo " xwindow-release - Make and validate the XF4 release" echo " clean - Clean everything" echo } if [ `whoami` != "root" ]; then echo "You probably should be root instead of `whoami` to run this safely." exit 1 fi START=`date` echo echo "***** OpenBSD - Release Building *****" echo echo "Dest: $DEST" echo "Release: $RELEASE" echo "CVS Server: $CVSROOT" echo "CVS Revision Tag: $CVSTAG" echo if [ $# = 0 ]; then usage; exit 1; fi for i in $* do case $i in install) install_sources ;; update) update_sources ;; kernel) build_kernel ;; system) build_system ;; release) make_release ;; xwindow) build_XF4 ;; xwindow-release) make_release_XF4 ;; clean) clean_everything ;; *) echo "********** Abort! Abort! **********" echo "Invalid option encountered: $i" echo "Exiting......." echo exit 1 ;; esac done echo echo "Start Time : $START" echo "Finish Time : `date`" echo