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

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

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

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