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

Annotation of openbsd/update_openbsd/release.sh, Revision 1.18

1.1       andrew      1: #!/bin/sh
1.18    ! andrew      2: # $RedRiver: release.sh,v 1.17 2008/04/16 20:49:54 andrew Exp $
1.1       andrew      3: #
1.14      andrew      4: # Copyright (c) 2002 - 2007 Steven Roberts <fenderq@fenderq.com>
1.1       andrew      5: #
1.14      andrew      6: # Permission to use, copy, modify, and distribute this software for any
                      7: # purpose with or without fee is hereby granted, provided that the above
                      8: # copyright notice and this permission notice appear in all copies.
                      9: #
                     10: # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     11: # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     12: # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     13: # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     14: # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     15: # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     16: # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     17: #
                     18:
                     19: #TAG="OPENBSD_4_2"
                     20: KERNEL="GENERIC"
                     21: ARCH="i386"
                     22: DEST="/home/destdir"
                     23: RELEASE="/home/releasedir"
                     24: XSRCDIR="/usr/src/xenocara"
                     25: PORTSPATH="/usr/ports"
1.1       andrew     26:
1.2       andrew     27: DEST="/usr/dest"
                     28: RELEASE="/usr/release"
1.14      andrew     29: TAG=${TAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`}
                     30: ARCH=`machine`
1.2       andrew     31: #SOURCES="src ports XF4"
1.6       andrew     32: #SOURCES="src ports"
1.14      andrew     33: SOURCES="/usr/src $XSRCDIR $PORTSPATH"
1.1       andrew     34:
                     35: # Anonymous CVS - http://www.openbsd.org/anoncvs.html
1.13      andrew     36: #CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs"
                     37: #CVSROOT="anoncvs@anoncvs1.usa.openbsd.org:/cvs"
                     38: CVSROOT="anoncvs@rt.fm:/cvs"
1.1       andrew     39: export CVSROOT
                     40:
1.18    ! andrew     41: if [ -e ${HOME}/.releaserc ]; then
        !            42:        . ${HOME}/.releaserc
        !            43: fi
1.14      andrew     44:
                     45: # See http://www.openbsd.org/anoncvs.html for instructions on fetching the
                     46: # sources for the first time.
1.1       andrew     47:
                     48: update_sources() {
1.14      andrew     49: echo "---------- Update sources ----------"
                     50: for d in $SOURCES; do
1.16      andrew     51:        _cvstag=-r$TAG
                     52:        if [ X"$TAG" == X"HEAD" ]; then
1.15      andrew     53:                _cvstag=""
1.14      andrew     54:        fi
1.17      andrew     55:        echo "cd $d && cvs -q -z6 update $_cvstag -Pd"
1.14      andrew     56:        cd $d && cvs -q -z6 update $_cvstag -Pd
                     57: done
1.1       andrew     58: }
                     59:
                     60: build_kernel() {
1.14      andrew     61: echo "---------- Build and install a new kernel ----------"
                     62: cd /usr/src/sys/arch/$ARCH/conf
                     63: config $KERNEL
                     64: cd ../compile/$KERNEL
                     65: make clean depend && make
                     66: cp /bsd /bsd.old && cp bsd /
1.1       andrew     67: }
                     68:
                     69: build_system() {
1.14      andrew     70: echo "---------- Build a new system ----------"
                     71: rm -rf /usr/obj/*
                     72: cd /usr/src && nice make obj
                     73: cd /usr/src/etc && export DESTDIR=/ && make distrib-dirs
                     74: cd /usr/src && nice make build
                     75: # Update /etc, /var, and /dev/MAKEDEV by hand.
                     76: }
                     77:
                     78: make_system_release() {
                     79: echo "---------- Make and validate the system release ----------"
                     80: cd /usr/src/distrib/crunch && make obj depend && make all install
                     81: export DESTDIR=$DEST; export RELEASEDIR=$RELEASE
                     82: if (-e $DESTDIR); then
                     83:        mkdir $DESTDIR/old-
                     84:        mv $DESTDIR/* $DESTDIR/old- 2>/dev/null
                     85:        rm -rf $DESTDIR/old- &
                     86: fi
                     87: mkdir -p $DESTDIR $RELEASEDIR
                     88: cd /usr/src/etc && nice make release
                     89: cd /usr/src/distrib/sets && sh checkflist
                     90: unset DESTDIR RELEASEDIR
                     91: }
                     92:
                     93: build_xenocara() {
                     94: echo "---------- Build and install xenocara ----------"
                     95: rm -rf /usr/xobj/*
                     96: cd $XSRCDIR
                     97: make bootstrap
                     98: make obj
                     99: make build
                    100: }
                    101:
                    102: make_xenocara_release() {
                    103: echo "---------- Make and validate the xenocara release ----------"
                    104: export DESTDIR=$DEST RELEASEDIR=$RELEASE
                    105: if (-e $DESTDIR); then
                    106:        mkdir $DESTDIR/old-
                    107:        mv $DESTDIR/* $DESTDIR/old- 2>/dev/null
                    108:        rm -rf $DESTDIR/old- &
                    109: fi
                    110: mkdir -p $DESTDIR $RELEASEDIR
                    111: cd $XSRCDIR
                    112: nice make release
                    113: unset DESTDIR RELEASEDIR
1.1       andrew    114: }
                    115:
                    116: usage() {
1.14      andrew    117: echo "  Usage: $0 <options>"
                    118: echo
                    119: echo "Options:"
                    120: echo
                    121: echo "  update           - Update sources"
                    122: echo "  kernel           - Build and install a new kernel"
                    123: echo "  system           - Build a new system"
                    124: echo "  system-release   - Make and validate the system release"
                    125: echo "  xenocara         - Build and install xenocara"
                    126: echo "  xenocara-release - Make and validate the xenocara release"
                    127: echo
1.1       andrew    128: }
                    129:
1.14      andrew    130: if [ $# = 0 ]; then usage; exit 1; fi
                    131:
                    132: if [ `whoami` != "root" ]; then
                    133: echo "You must be root to create a release."
                    134: exit 1
                    135: fi
                    136:
1.1       andrew    137: START=`date`
                    138: echo
1.14      andrew    139: echo ".: release.sh - building an OpenBSD release :."
                    140: echo "----------------------------------------------"
1.1       andrew    141: echo
1.14      andrew    142: echo "    Tag: $TAG"
                    143: echo " Kernel: $KERNEL-$ARCH"
                    144: echo "   Dest: $DEST"
1.1       andrew    145: echo "Release: $RELEASE"
                    146: echo
                    147:
                    148: for i in $*
                    149: do
1.14      andrew    150: case $i in
                    151: full-release)
                    152: build_xenocara
                    153: build_system
                    154: make_xenocara_release
                    155: make_system_release
                    156: ;;
                    157: update)
                    158: update_sources
                    159: ;;
                    160: kernel)
                    161: build_kernel
                    162: ;;
                    163: system)
                    164: build_system
                    165: ;;
                    166: system-release)
                    167: make_system_release
                    168: ;;
                    169: xenocara)
                    170: build_xenocara
                    171: ;;
                    172: xenocara-release)
                    173: make_xenocara_release
                    174: ;;
                    175: *)
                    176: echo "---------- Abort! Abort! ----------"
                    177: echo "Invalid option encountered: $i"
                    178: echo "Exiting......."
                    179: echo
                    180: exit 1
                    181: ;;
                    182: esac
1.1       andrew    183: done
                    184: echo
1.14      andrew    185: echo " Start Time : $START"
1.1       andrew    186: echo "Finish Time : `date`"
                    187: echo

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>