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

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

1.1       andrew      1: #!/bin/sh
1.19    ! andrew      2: # $RedRiver: release.sh,v 1.18 2008/04/16 20:54:28 andrew Exp $
1.1       andrew      3: #
1.19    ! andrew      4: # Copyright (c) 2002, 2008 Steven Roberts <sroberts@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:
1.19    ! andrew     19: TAG=${TAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`}
1.14      andrew     20: KERNEL="GENERIC"
1.19    ! andrew     21: ARCH=`machine`
1.14      andrew     22: DEST="/home/destdir"
                     23: RELEASE="/home/releasedir"
                     24: XSRCDIR="/usr/src/xenocara"
                     25: PORTSPATH="/usr/ports"
1.1       andrew     26:
                     27: # Anonymous CVS - http://www.openbsd.org/anoncvs.html
1.13      andrew     28: #CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs"
                     29: #CVSROOT="anoncvs@anoncvs1.usa.openbsd.org:/cvs"
                     30: CVSROOT="anoncvs@rt.fm:/cvs"
1.1       andrew     31: export CVSROOT
                     32:
1.18      andrew     33: if [ -e ${HOME}/.releaserc ]; then
                     34:        . ${HOME}/.releaserc
                     35: fi
1.14      andrew     36:
                     37: # See http://www.openbsd.org/anoncvs.html for instructions on fetching the
                     38: # sources for the first time.
1.1       andrew     39:
                     40: update_sources() {
1.14      andrew     41: echo "---------- Update sources ----------"
1.19    ! andrew     42: for d in /usr/src ${XSRCDIR} ${PORTSPATH}; do
        !            43:        _cvstag=-r$TAG
        !            44:        if [ X"$TAG" == X"HEAD" ]; then
        !            45:                _cvstag=""
        !            46:        fi
        !            47:        echo "cd $d && cvs update $_cvstag -Pd"
        !            48:        cd $d && cvs update $_cvstag -Pd
1.14      andrew     49: done
1.1       andrew     50: }
                     51:
                     52: build_kernel() {
1.14      andrew     53: echo "---------- Build and install a new kernel ----------"
                     54: cd /usr/src/sys/arch/$ARCH/conf
                     55: config $KERNEL
                     56: cd ../compile/$KERNEL
                     57: make clean depend && make
1.19    ! andrew     58: make install
1.1       andrew     59: }
                     60:
                     61: build_system() {
1.14      andrew     62: echo "---------- Build a new system ----------"
                     63: rm -rf /usr/obj/*
                     64: cd /usr/src && nice make obj
1.19    ! andrew     65: cd /usr/src/etc && env DESTDIR=/ make distrib-dirs
1.14      andrew     66: cd /usr/src && nice make build
                     67: # Update /etc, /var, and /dev/MAKEDEV by hand.
                     68: }
                     69:
                     70: make_system_release() {
                     71: echo "---------- Make and validate the system release ----------"
                     72: cd /usr/src/distrib/crunch && make obj depend && make all install
                     73: export DESTDIR=$DEST; export RELEASEDIR=$RELEASE
1.19    ! andrew     74: rm -rf $DESTDIR
1.14      andrew     75: mkdir -p $DESTDIR $RELEASEDIR
                     76: cd /usr/src/etc && nice make release
                     77: cd /usr/src/distrib/sets && sh checkflist
                     78: unset DESTDIR RELEASEDIR
                     79: }
                     80:
                     81: build_xenocara() {
                     82: echo "---------- Build and install xenocara ----------"
                     83: rm -rf /usr/xobj/*
1.19    ! andrew     84: mkdir -p /usr/xobj
1.14      andrew     85: cd $XSRCDIR
                     86: make bootstrap
                     87: make obj
                     88: make build
                     89: }
                     90:
                     91: make_xenocara_release() {
                     92: echo "---------- Make and validate the xenocara release ----------"
                     93: export DESTDIR=$DEST RELEASEDIR=$RELEASE
1.19    ! andrew     94: rm -rf $DESTDIR
1.14      andrew     95: mkdir -p $DESTDIR $RELEASEDIR
                     96: cd $XSRCDIR
                     97: nice make release
                     98: unset DESTDIR RELEASEDIR
1.1       andrew     99: }
                    100:
                    101: usage() {
1.14      andrew    102: echo "  Usage: $0 <options>"
                    103: echo
                    104: echo "Options:"
                    105: echo
                    106: echo "  update           - Update sources"
                    107: echo "  kernel           - Build and install a new kernel"
                    108: echo "  system           - Build a new system"
                    109: echo "  system-release   - Make and validate the system release"
                    110: echo "  xenocara         - Build and install xenocara"
                    111: echo "  xenocara-release - Make and validate the xenocara release"
1.19    ! andrew    112: echo "  full-release     - Do system, xenocara, system-release, xenocara-release"
1.14      andrew    113: echo
1.1       andrew    114: }
                    115:
1.14      andrew    116: if [ `whoami` != "root" ]; then
1.19    ! andrew    117: echo "You must be root to build a release."
1.14      andrew    118: exit 1
                    119: fi
                    120:
1.1       andrew    121: START=`date`
                    122: echo
1.14      andrew    123: echo ".: release.sh - building an OpenBSD release :."
                    124: echo "----------------------------------------------"
1.1       andrew    125: echo
1.14      andrew    126: echo "    Tag: $TAG"
                    127: echo " Kernel: $KERNEL-$ARCH"
                    128: echo "   Dest: $DEST"
1.1       andrew    129: echo "Release: $RELEASE"
                    130: echo
1.19    ! andrew    131:
        !           132: if [ $# = 0 ]; then usage; exit 1; fi
1.1       andrew    133:
                    134: for i in $*
                    135: do
1.14      andrew    136: case $i in
                    137: full-release)
                    138: build_xenocara
                    139: build_system
                    140: make_xenocara_release
                    141: make_system_release
                    142: ;;
                    143: update)
                    144: update_sources
                    145: ;;
                    146: kernel)
                    147: build_kernel
                    148: ;;
                    149: system)
                    150: build_system
                    151: ;;
                    152: system-release)
                    153: make_system_release
                    154: ;;
                    155: xenocara)
                    156: build_xenocara
                    157: ;;
                    158: xenocara-release)
                    159: make_xenocara_release
                    160: ;;
                    161: *)
                    162: echo "---------- Abort! Abort! ----------"
                    163: echo "Invalid option encountered: $i"
                    164: echo "Exiting......."
                    165: echo
                    166: exit 1
                    167: ;;
                    168: esac
1.1       andrew    169: done
                    170: echo
1.14      andrew    171: echo " Start Time : $START"
1.1       andrew    172: echo "Finish Time : `date`"
                    173: echo

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