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

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

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

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