=================================================================== RCS file: /cvs/openbsd/update_openbsd/release.sh,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- openbsd/update_openbsd/release.sh 2007/11/19 22:08:37 1.13 +++ openbsd/update_openbsd/release.sh 2007/11/20 20:08:31 1.14 @@ -1,47 +1,36 @@ #!/bin/sh -# $RedRiver: release.sh,v 1.12 2007/09/09 21:40:41 andrew Exp $ -# Copyright (c) 2002 - 2006, FenderQ -# All rights reserved. +# $RedRiver: release.sh,v 1.13 2007/11/19 22:08:37 andrew Exp $ # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: +# Copyright (c) 2002 - 2007 Steven Roberts # -# * 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. +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. # -# 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. +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -# -------------------------------------------- -# OpenBSD - Release Building Shell Script v3.9 -# -# FenderQ.com - Internet Security Solutions -# http://www.fenderq.com/ -# -# SEE ALSO release(8) -# +#TAG="OPENBSD_4_2" +KERNEL="GENERIC" +ARCH="i386" +DEST="/home/destdir" +RELEASE="/home/releasedir" +XSRCDIR="/usr/src/xenocara" +PORTSPATH="/usr/ports" + DEST="/usr/dest" RELEASE="/usr/release" -CVSTAG=${CVSTAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`} +TAG=${TAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`} +ARCH=`machine` #SOURCES="src ports XF4" #SOURCES="src ports" -SOURCES="src ports XF4" +SOURCES="/usr/src $XSRCDIR $PORTSPATH" # Anonymous CVS - http://www.openbsd.org/anoncvs.html #CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs" @@ -49,150 +38,147 @@ CVSROOT="anoncvs@rt.fm:/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 -} +# See http://www.openbsd.org/anoncvs.html for instructions on fetching the +# sources for the first time. + update_sources() { - echo "********** Update sources **********" - for d in $SOURCES; do - _cvstag=-r$CVSTAG - if [ X"$CVSTAG" == X"HEAD" ]; then - _cvstag=-A - fi - cd /usr && cvs -q -z6 update $_cvstag -Pd $d - done +echo "---------- Update sources ----------" +for d in $SOURCES; do + _cvstag=-r$CVSTAG + if [ X"$CVSTAG" == X"HEAD" ]; then + _cvstag=-A + fi + cd $d && cvs -q -z6 update $_cvstag -Pd +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 / +echo "---------- Build and install a new kernel ----------" +cd /usr/src/sys/arch/$ARCH/conf +config $KERNEL +cd ../compile/$KERNEL +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 +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 +# Update /etc, /var, and /dev/MAKEDEV by hand. } -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 - ls $RELEASEDIR | grep -v index.txt | sort > $RELEASEDIR/index.txt - unset DESTDIR RELEASEDIR +make_system_release() { +echo "---------- Make and validate the system release ----------" +cd /usr/src/distrib/crunch && make obj depend && make all install +export DESTDIR=$DEST; export RELEASEDIR=$RELEASE +if (-e $DESTDIR); then + mkdir $DESTDIR/old- + mv $DESTDIR/* $DESTDIR/old- 2>/dev/null + rm -rf $DESTDIR/old- & +fi +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 +build_xenocara() { +echo "---------- Build and install xenocara ----------" +rm -rf /usr/xobj/* +cd $XSRCDIR +make bootstrap +make obj +make build } -make_release_XF4() { - echo "********** Make and validate the XF4 release **********" - export DESTDIR=$DEST RELEASEDIR=$RELEASE - rm -rf $DESTDIR/* - mkdir -p $DESTDIR $RELEASEDIR - cd /usr/Xbuild && nice make release - cd /usr/Xbuild/distrib/sets && sh checkflist - ls $RELEASEDIR | grep -v index.txt | sort > $RELEASEDIR/index.txt - unset DESTDIR RELEASEDIR +make_xenocara_release() { +echo "---------- Make and validate the xenocara release ----------" +export DESTDIR=$DEST RELEASEDIR=$RELEASE +if (-e $DESTDIR); then + mkdir $DESTDIR/old- + mv $DESTDIR/* $DESTDIR/old- 2>/dev/null + rm -rf $DESTDIR/old- & +fi +mkdir -p $DESTDIR $RELEASEDIR +cd $XSRCDIR +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 +echo " Usage: $0 " +echo +echo "Options:" +echo +echo " update - Update sources" +echo " kernel - Build and install a new kernel" +echo " system - Build a new system" +echo " system-release - Make and validate the system release" +echo " xenocara - Build and install xenocara" +echo " xenocara-release - Make and validate the xenocara release" +echo } +if [ $# = 0 ]; then usage; exit 1; fi + +if [ `whoami` != "root" ]; then +echo "You must be root to create a release." +exit 1 +fi + START=`date` echo -echo "***** OpenBSD - Release Building *****" +echo ".: release.sh - building an OpenBSD release :." +echo "----------------------------------------------" echo -echo "Dest: $DEST" +echo " Tag: $TAG" +echo " Kernel: $KERNEL-$ARCH" +echo " Dest: $DEST" echo "Release: $RELEASE" -echo "CVS Server: $CVSROOT" -echo "CVS Revision Tag: $CVSTAG" echo -if [ $# = 0 ]; then usage; exit 1; fi - -if [ `id -u` != "0" ]; then - echo "You probably should be root instead of `whoami` to run this safely." - 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 +case $i in +full-release) +build_xenocara +build_system +make_xenocara_release +make_system_release +;; +case $i in +update) +update_sources +;; +kernel) +build_kernel +;; +system) +build_system +;; +system-release) +make_system_release +;; +xenocara) +build_xenocara +;; +xenocara-release) +make_xenocara_release +;; +*) +echo "---------- Abort! Abort! ----------" +echo "Invalid option encountered: $i" +echo "Exiting......." +echo +exit 1 +;; +esac done echo -echo "Start Time : $START" +echo " Start Time : $START" echo "Finish Time : `date`" echo