version 1.5, 2006/10/13 19:18:51 |
version 1.19, 2008/05/22 18:39:20 |
|
|
#!/bin/sh |
#!/bin/sh |
# $RedRiver: release.sh,v 1.4 2006/10/13 18:12:23 andrew Exp $ |
# $RedRiver: release.sh,v 1.18 2008/04/16 20:54:28 andrew Exp $ |
# Copyright (c) 2002 - 2006, FenderQ |
|
# All rights reserved. |
|
# |
# |
# Redistribution and use in source and binary forms, with or without |
# Copyright (c) 2002, 2008 Steven Roberts <sroberts@fenderq.com> |
# modification, are permitted provided that the following conditions are met: |
|
# |
# |
# * Redistributions of source code must retain the above copyright |
# Permission to use, copy, modify, and distribute this software for any |
# notice, this list of conditions and the following disclaimer. |
# purpose with or without fee is hereby granted, provided that the above |
# * Redistributions in binary form must reproduce the above copyright |
# copyright notice and this permission notice appear in all copies. |
# 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" |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
# 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" |
TAG=${TAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`} |
RELEASE="/usr/release" |
KERNEL="GENERIC" |
CVSTAG=`uname -r | awk '{ sub("\\\.","_"); print "OPENBSD_" $0 }'` |
ARCH=`machine` |
#SOURCES="src ports XF4" |
DEST="/home/destdir" |
SOURCES="src ports" |
RELEASE="/home/releasedir" |
|
XSRCDIR="/usr/src/xenocara" |
|
PORTSPATH="/usr/ports" |
|
|
# Anonymous CVS - http://www.openbsd.org/anoncvs.html |
# Anonymous CVS - http://www.openbsd.org/anoncvs.html |
CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs" |
#CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs" |
|
#CVSROOT="anoncvs@anoncvs1.usa.openbsd.org:/cvs" |
|
CVSROOT="anoncvs@rt.fm:/cvs" |
export CVSROOT |
export CVSROOT |
|
|
install_sources() { |
if [ -e ${HOME}/.releaserc ]; then |
echo "********** Install sources **********" |
. ${HOME}/.releaserc |
cd /usr |
fi |
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() { |
update_sources() { |
echo "********** Update sources **********" |
echo "---------- Update sources ----------" |
for d in $SOURCES; do |
for d in /usr/src ${XSRCDIR} ${PORTSPATH}; do |
cd /usr && cvs -q -z6 update -r$CVSTAG -Pd $d |
_cvstag=-r$TAG |
done |
if [ X"$TAG" == X"HEAD" ]; then |
|
_cvstag="" |
|
fi |
|
echo "cd $d && cvs update $_cvstag -Pd" |
|
cd $d && cvs update $_cvstag -Pd |
|
done |
} |
} |
|
|
build_kernel() { |
build_kernel() { |
echo "********** Build and install a new kernel **********" |
echo "---------- Build and install a new kernel ----------" |
cd /usr/src/sys/arch/i386/conf |
cd /usr/src/sys/arch/$ARCH/conf |
config GENERIC |
config $KERNEL |
cd ../compile/GENERIC |
cd ../compile/$KERNEL |
make clean depend && make |
make clean depend && make |
cp /bsd /bsd.old && cp bsd / |
make install |
} |
} |
|
|
build_system() { |
build_system() { |
echo "********** Build a new system **********" |
echo "---------- Build a new system ----------" |
rm -rf /usr/obj/* |
rm -rf /usr/obj/* |
cd /usr/src && nice make obj |
cd /usr/src && nice make obj |
cd /usr/src/etc && export DESTDIR=/ && make distrib-dirs |
cd /usr/src/etc && env DESTDIR=/ make distrib-dirs |
cd /usr/src && nice make build |
cd /usr/src && nice make build |
|
# Update /etc, /var, and /dev/MAKEDEV by hand. |
} |
} |
|
|
make_release() { |
make_system_release() { |
echo "********** Make and validate the system release **********" |
echo "---------- Make and validate the system release ----------" |
cd /usr/src/distrib/crunch && make obj depend all install |
cd /usr/src/distrib/crunch && make obj depend && make all install |
export DESTDIR=$DEST RELEASEDIR=$RELEASE |
export DESTDIR=$DEST; export RELEASEDIR=$RELEASE |
rm -rf $DESTDIR/* |
rm -rf $DESTDIR |
mkdir -p $DESTDIR $RELEASEDIR |
mkdir -p $DESTDIR $RELEASEDIR |
cd /usr/src/etc && nice make release |
cd /usr/src/etc && nice make release |
cd /usr/src/distrib/sets && sh checkflist |
cd /usr/src/distrib/sets && sh checkflist |
unset DESTDIR RELEASEDIR |
unset DESTDIR RELEASEDIR |
} |
} |
|
|
build_XF4() { |
build_xenocara() { |
echo "********** Build and install XF4 **********" |
echo "---------- Build and install xenocara ----------" |
rm -rf /usr/Xbuild |
rm -rf /usr/xobj/* |
mkdir -p /usr/Xbuild |
mkdir -p /usr/xobj |
cd /usr/ports/lang/tcl/8.4 && make install |
cd $XSRCDIR |
cd /usr/ports/x11/tk/8.4 && make install |
make bootstrap |
cd /usr/Xbuild && lndir /usr/XF4 && nice make build |
make obj |
|
make build |
} |
} |
|
|
make_release_XF4() { |
make_xenocara_release() { |
echo "********** Make and validate the XF4 release **********" |
echo "---------- Make and validate the xenocara release ----------" |
export DESTDIR=$DEST RELEASEDIR=$RELEASE |
export DESTDIR=$DEST RELEASEDIR=$RELEASE |
rm -rf $DESTDIR |
rm -rf $DESTDIR |
mkdir -p $DESTDIR $RELEASEDIR |
mkdir -p $DESTDIR $RELEASEDIR |
nice make release |
cd $XSRCDIR |
unset DESTDIR RELEASEDIR |
nice make release |
|
unset DESTDIR RELEASEDIR |
} |
} |
|
|
clean_everything() { |
|
echo "********** Clean everything **********" |
|
rm -rf /usr/obj/* $DEST /usr/Xbuild |
|
} |
|
|
|
usage() { |
usage() { |
echo "Usage: $0 options" |
echo " Usage: $0 <options>" |
echo |
echo |
echo "Options:" |
echo "Options:" |
echo |
echo |
echo " install - Install sources" |
echo " update - Update sources" |
echo " update - Update sources" |
echo " kernel - Build and install a new kernel" |
echo " kernel - Build and install a new kernel" |
echo " system - Build a new system" |
echo " system - Build a new system" |
echo " system-release - Make and validate the system release" |
echo " release - Make and validate the system release" |
echo " xenocara - Build and install xenocara" |
echo " xwindow - Build and install XF4" |
echo " xenocara-release - Make and validate the xenocara release" |
echo " xwindow-release - Make and validate the XF4 release" |
echo " full-release - Do system, xenocara, system-release, xenocara-release" |
echo " clean - Clean everything" |
echo |
echo |
|
} |
} |
|
|
if [ `whoami` != "root" ]; then |
if [ `whoami` != "root" ]; then |
echo "You probably should be root instead of `whoami` to run this safely." |
echo "You must be root to build a release." |
exit 1 |
exit 1 |
fi |
fi |
|
|
START=`date` |
START=`date` |
echo |
echo |
echo "***** OpenBSD - Release Building *****" |
echo ".: release.sh - building an OpenBSD release :." |
|
echo "----------------------------------------------" |
echo |
echo |
echo "Dest: $DEST" |
echo " Tag: $TAG" |
|
echo " Kernel: $KERNEL-$ARCH" |
|
echo " Dest: $DEST" |
echo "Release: $RELEASE" |
echo "Release: $RELEASE" |
echo "CVS Server: $CVSROOT" |
|
echo "CVS Revision Tag: $CVSTAG" |
|
echo |
echo |
|
|
if [ $# = 0 ]; then usage; exit 1; fi |
if [ $# = 0 ]; then usage; exit 1; fi |
|
|
for i in $* |
for i in $* |
do |
do |
case $i in |
case $i in |
install) |
full-release) |
install_sources |
build_xenocara |
;; |
build_system |
update) |
make_xenocara_release |
update_sources |
make_system_release |
;; |
;; |
kernel) |
update) |
build_kernel |
update_sources |
;; |
;; |
system) |
kernel) |
build_system |
build_kernel |
;; |
;; |
release) |
system) |
make_release |
build_system |
;; |
;; |
xwindow) |
system-release) |
build_XF4 |
make_system_release |
;; |
;; |
xwindow-release) |
xenocara) |
make_release_XF4 |
build_xenocara |
;; |
;; |
clean) |
xenocara-release) |
clean_everything |
make_xenocara_release |
;; |
;; |
*) |
*) |
echo "********** Abort! Abort! **********" |
echo "---------- Abort! Abort! ----------" |
echo "Invalid option encountered: $i" |
echo "Invalid option encountered: $i" |
echo "Exiting......." |
echo "Exiting......." |
echo |
echo |
exit 1 |
exit 1 |
;; |
;; |
esac |
esac |
done |
done |
echo |
echo |
echo "Start Time : $START" |
echo " Start Time : $START" |
echo "Finish Time : `date`" |
echo "Finish Time : `date`" |
echo |
echo |