[BACK]Return to release.sh CVS log [TXT][DIR] Up to [local] / openbsd / update_openbsd

File: [local] / openbsd / update_openbsd / release.sh (download)

Revision 1.23, Sat Oct 11 22:11:58 2008 UTC (15 years, 7 months ago) by andrew
Branch: MAIN
Changes since 1.22: +3 -3 lines

use opencvs instead of cvs

#!/bin/sh
# $RedRiver: release.sh,v 1.22 2008/07/08 22:46:01 andrew Exp $
#
# Copyright (c) 2002, 2008 Steven Roberts <sroberts@fenderq.com>
#
# 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.
#
# 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.
#

TAG=${TAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`}
KERNEL="GENERIC"
ARCH=`machine`
DEST="/home/destdir"
RELEASE="/home/releasedir"
XSRCDIR="/usr/xenocara"
PORTSPATH="/usr/ports"

if [ -e ${HOME}/.releaserc ]; then
	. ${HOME}/.releaserc
fi

# See http://www.openbsd.org/anoncvs.html for instructions on fetching the
# sources for the first time.

update_sources() {
echo "---------- Update sources ----------"
_cvstag=-r$TAG
if [ X"$TAG" == X"HEAD" ]; then
	_cvstag=""
fi
for d in /usr/src ${XSRCDIR} ${PORTSPATH}; do
       echo "cd $d && opencvs update $_cvstag -Pd"
       cd $d && opencvs update $_cvstag -Pd
done
}

build_kernel() {
echo "---------- Build and install a new kernel ----------"
cd /usr/src/sys/arch/$ARCH/conf
config $KERNEL
cd ../compile/$KERNEL
make clean depend && make
make install
}

build_system() {
echo "---------- Build a new system ----------"
rm -rf /usr/obj/*
cd /usr/src && nice make obj
cd /usr/src/etc && env DESTDIR=/ make distrib-dirs
cd /usr/src && nice make build
# Update /etc, /var, and /dev/MAKEDEV by hand.
}

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
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_xenocara() {
echo "---------- Build and install xenocara ----------"
rm -rf /usr/xobj/*
mkdir -p /usr/xobj
cd $XSRCDIR
make bootstrap
make obj
make build
}

make_xenocara_release() {
echo "---------- Make and validate the xenocara release ----------"
export DESTDIR=$DEST RELEASEDIR=$RELEASE
rm -rf $DESTDIR
mkdir -p $DESTDIR $RELEASEDIR
cd $XSRCDIR
nice make release
unset DESTDIR RELEASEDIR
}

usage() {
echo "  Usage: $0 <options>" 
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 "  full-release     - Do system, xenocara, system-release, xenocara-release"
echo
}

if [ `whoami` != "root" ]; then
echo "You must be root to build a release." 
exit 1
fi

START=`date`
echo
echo ".: release.sh - building an OpenBSD release :."
echo "----------------------------------------------"
echo
echo "    Tag: $TAG"
echo " Kernel: $KERNEL-$ARCH"
echo "   Dest: $DEST"
echo "Release: $RELEASE"
echo

if [ $# = 0 ]; then usage; exit 1; fi

for i in $*
do
case $i in
full-release)
build_xenocara
build_system
make_xenocara_release
make_system_release
;;
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 "Finish Time : `date`"
echo