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

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

1.1       andrew      1: #!/bin/sh
1.13    ! andrew      2: # $RedRiver: release.sh,v 1.12 2007/09/09 21:40:41 andrew Exp $
1.1       andrew      3: # Copyright (c) 2002 - 2006, FenderQ
                      4: # All rights reserved.
                      5: #
                      6: # Redistribution and use in source and binary forms, with or without
                      7: # modification, are permitted provided that the following conditions are met:
                      8: #
                      9: #   * Redistributions of source code must retain the above copyright
                     10: #     notice, this list of conditions and the following disclaimer.
                     11: #   * Redistributions in binary form must reproduce the above copyright
                     12: #     notice, this list of conditions and the following disclaimer in the
                     13: #     documentation and/or other materials provided with the distribution.
                     14: #   * Neither the name of FenderQ nor the names of its contributors
                     15: #     may be used to endorse or promote products derived from this software
                     16: #     without specific prior written permission.
                     17: #
                     18: # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
                     19: # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     20: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     21: # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
                     22: # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     23: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     24: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     25: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     26: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     27: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     28: # POSSIBILITY OF SUCH DAMAGE.
                     29: #
                     30: # --------------------------------------------
                     31: # OpenBSD - Release Building Shell Script v3.9
                     32: #
                     33: # FenderQ.com - Internet Security Solutions
                     34: # http://www.fenderq.com/
                     35: #
                     36: # SEE ALSO release(8)
                     37: #
                     38:
1.2       andrew     39: DEST="/usr/dest"
                     40: RELEASE="/usr/release"
1.9       andrew     41: CVSTAG=${CVSTAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`}
1.2       andrew     42: #SOURCES="src ports XF4"
1.6       andrew     43: #SOURCES="src ports"
1.10      andrew     44: SOURCES="src ports XF4"
1.1       andrew     45:
                     46: # Anonymous CVS - http://www.openbsd.org/anoncvs.html
1.13    ! andrew     47: #CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs"
        !            48: #CVSROOT="anoncvs@anoncvs1.usa.openbsd.org:/cvs"
        !            49: CVSROOT="anoncvs@rt.fm:/cvs"
1.1       andrew     50: export CVSROOT
                     51:
                     52: install_sources() {
                     53:        echo "********** Install sources **********"
                     54:        cd /usr
1.2       andrew     55:        for d in $SOURCES; do
                     56:                rm -rf $d/*
                     57:                cvs -q -z6 checkout -r$CVSTAG -P $d
                     58:        done
1.1       andrew     59: }
                     60:
                     61: update_sources() {
                     62:        echo "********** Update sources **********"
1.2       andrew     63:        for d in $SOURCES; do
1.8       andrew     64:                _cvstag=-r$CVSTAG
                     65:                if [ X"$CVSTAG" == X"HEAD" ]; then
                     66:                        _cvstag=-A
                     67:                fi
                     68:                cd /usr && cvs -q -z6 update $_cvstag -Pd $d
1.2       andrew     69:        done
1.1       andrew     70: }
                     71:
                     72: build_kernel() {
                     73:        echo "********** Build and install a new kernel **********"
                     74:        cd /usr/src/sys/arch/i386/conf
                     75:        config GENERIC
                     76:        cd ../compile/GENERIC
                     77:        make clean depend && make
                     78:        cp /bsd /bsd.old && cp bsd /
                     79: }
                     80:
                     81: build_system() {
                     82:        echo "********** Build a new system **********"
                     83:        rm -rf /usr/obj/*
                     84:        cd /usr/src && nice make obj
                     85:        cd /usr/src/etc && export DESTDIR=/ && make distrib-dirs
                     86:        cd /usr/src && nice make build
                     87: }
                     88:
                     89: make_release() {
                     90:        echo "********** Make and validate the system release **********"
                     91:        cd /usr/src/distrib/crunch && make obj depend all install
                     92:        export DESTDIR=$DEST RELEASEDIR=$RELEASE
1.4       andrew     93:        rm -rf $DESTDIR/*
1.1       andrew     94:        mkdir -p $DESTDIR $RELEASEDIR
                     95:        cd /usr/src/etc && nice make release
                     96:        cd /usr/src/distrib/sets && sh checkflist
1.7       andrew     97:        ls $RELEASEDIR | grep -v index.txt | sort > $RELEASEDIR/index.txt
1.1       andrew     98:        unset DESTDIR RELEASEDIR
                     99: }
                    100:
                    101: build_XF4() {
                    102:        echo "********** Build and install XF4 **********"
                    103:        rm -rf /usr/Xbuild
                    104:        mkdir -p /usr/Xbuild
                    105:        cd /usr/ports/lang/tcl/8.4 && make install
                    106:        cd /usr/ports/x11/tk/8.4 && make install
                    107:        cd /usr/Xbuild && lndir /usr/XF4 && nice make build
                    108: }
                    109:
                    110: make_release_XF4() {
                    111:        echo "********** Make and validate the XF4 release **********"
                    112:        export DESTDIR=$DEST RELEASEDIR=$RELEASE
1.6       andrew    113:        rm -rf $DESTDIR/*
1.1       andrew    114:        mkdir -p $DESTDIR $RELEASEDIR
1.6       andrew    115:        cd /usr/Xbuild && nice make release
                    116:        cd /usr/Xbuild/distrib/sets && sh checkflist
1.7       andrew    117:        ls $RELEASEDIR | grep -v index.txt | sort > $RELEASEDIR/index.txt
1.1       andrew    118:        unset DESTDIR RELEASEDIR
                    119: }
                    120:
                    121: clean_everything() {
                    122:        echo "********** Clean everything **********"
1.6       andrew    123:        rm -rf /usr/obj/* $DEST/* /usr/Xbuild
1.1       andrew    124: }
                    125:
                    126: usage() {
                    127:        echo "Usage: $0 options"
                    128:        echo
                    129:        echo "Options:"
                    130:        echo
                    131:        echo "  install            - Install sources"
                    132:        echo "  update             - Update sources"
                    133:        echo "  kernel             - Build and install a new kernel"
                    134:        echo "  system             - Build a new system"
                    135:        echo "  release            - Make and validate the system release"
                    136:        echo "  xwindow            - Build and install XF4"
                    137:        echo "  xwindow-release    - Make and validate the XF4 release"
                    138:        echo "  clean              - Clean everything"
                    139:        echo
                    140: }
                    141:
                    142: START=`date`
                    143: echo
                    144: echo "***** OpenBSD - Release Building *****"
                    145: echo
                    146: echo "Dest: $DEST"
                    147: echo "Release: $RELEASE"
                    148: echo "CVS Server: $CVSROOT"
                    149: echo "CVS Revision Tag: $CVSTAG"
                    150: echo
                    151:
                    152: if [ $# = 0 ]; then usage; exit 1; fi
1.11      andrew    153:
1.12      andrew    154: if [ `id -u` != "0" ]; then
1.11      andrew    155:        echo "You probably should be root instead of `whoami` to run this safely."
                    156:        exit 1
                    157: fi
1.1       andrew    158:
                    159: for i in $*
                    160: do
                    161:        case $i in
                    162:                install)
                    163:                install_sources
                    164:                ;;
                    165:                update)
                    166:                update_sources
                    167:                ;;
                    168:                kernel)
                    169:                build_kernel
                    170:                ;;
                    171:                system)
                    172:                build_system
                    173:                ;;
                    174:                release)
                    175:                make_release
                    176:                ;;
                    177:                xwindow)
                    178:                build_XF4
                    179:                ;;
                    180:                xwindow-release)
                    181:                make_release_XF4
                    182:                ;;
                    183:                clean)
                    184:                clean_everything
                    185:                ;;
                    186:                *)
                    187:                echo "********** Abort! Abort! **********"
                    188:                echo "Invalid option encountered: $i"
                    189:                echo "Exiting......."
                    190:                echo
                    191:                exit 1
                    192:                ;;
                    193:        esac
                    194: done
                    195: echo
                    196: echo "Start Time  : $START"
                    197: echo "Finish Time : `date`"
                    198: echo

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