#!/bin/sh # $RedRiver: release.sh,v 1.28 2008/11/05 17:14:40 andrew Exp $ # # Copyright (c) 2002, 2008 Steven Roberts # # 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. # local _origtag=${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 /etc/release.conf ]; then . /etc/release.conf fi export CVSROOT if [ X"" != X"${_origtag}" ]; then TAG=$_origtag fi # See http://www.openbsd.org/anoncvs.html for instructions on fetching the # sources for the first time. update_sources() { echo "---------- Update sources ----------" local _d for _d in /usr/src "${XSRCDIR}" "${PORTSPATH}"; do if [ -d $_d ]; then echo [$_d] opencvs update -r $TAG -PAd cd $_d && opencvs update -r $TAG -PAd fi 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 echo Update /etc, /var, and /dev/MAKEDEV, either by hand or using sysmerge\(8\). } 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 [ X"$DESTDIR" == X"" ]; then echo PLEASE SET \$DEST! >2& exit fi rm -rf $DESTDIR/* $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 ----------" cd $XSRCDIR make bootstrap make obj make build } make_xenocara_release() { echo "---------- Make and validate the xenocara release ----------" export DESTDIR=$DEST RELEASEDIR=$RELEASE if [ X"$DESTDIR" == X"" ]; then echo PLEASE SET \$DEST! >2& exit fi rm -rf $DESTDIR/* $DESTDIR/.* mkdir -p $DESTDIR $RELEASEDIR cd $XSRCDIR nice make release unset DESTDIR RELEASEDIR } usage() { 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 " full-release - xenocara, xenocara-release, system, system-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" if [ X"$CVSROOT" != X"" ]; then echo " Root: $CVSROOT" fi echo if [ $# = 0 ]; then usage; exit 1; fi for i in $* do 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 ;; full-release) build_xenocara make_xenocara_release build_system make_system_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