Annotation of openbsd/update_openbsd/release.sh, Revision 1.25
1.1 andrew 1: #!/bin/sh
1.25 ! andrew 2: # $RedRiver: release.sh,v 1.24 2008/10/20 22:06:57 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.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.25 ! andrew 31: export CVSROOT
1.14 andrew 32:
1.24 andrew 33: if [ X"" != X"${_origtag}" ]; then
34: TAG=$_origtag
35: fi
36:
37:
1.14 andrew 38: # See http://www.openbsd.org/anoncvs.html for instructions on fetching the
39: # sources for the first time.
1.1 andrew 40:
41: update_sources() {
1.14 andrew 42: echo "---------- Update sources ----------"
1.24 andrew 43: local _d
44: for _d in /usr/src "${XSRCDIR}" "${PORTSPATH}"; do
45: if [ -d $_d ]; then
46: echo [$_d] cvs update -r $TAG -Pd
47: cd $_d && cvs update -r $TAG -Pd
48: fi
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
1.24 andrew 67: echo Update /etc, /var, and /dev/MAKEDEV, either by hand or using sysmerge\(8\).
1.14 andrew 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.25 ! andrew 74: rm -rf $DESTDIR/* $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: cd $XSRCDIR
84: make bootstrap
85: make obj
86: make build
87: }
88:
89: make_xenocara_release() {
90: echo "---------- Make and validate the xenocara release ----------"
91: export DESTDIR=$DEST RELEASEDIR=$RELEASE
1.19 andrew 92: rm -rf $DESTDIR
1.14 andrew 93: mkdir -p $DESTDIR $RELEASEDIR
94: cd $XSRCDIR
95: nice make release
96: unset DESTDIR RELEASEDIR
1.1 andrew 97: }
98:
99: usage() {
1.14 andrew 100: echo " Usage: $0 <options>"
101: echo
102: echo "Options:"
103: echo
104: echo " update - Update sources"
105: echo " kernel - Build and install a new kernel"
106: echo " system - Build a new system"
107: echo " system-release - Make and validate the system release"
108: echo " xenocara - Build and install xenocara"
109: echo " xenocara-release - Make and validate the xenocara release"
1.19 andrew 110: echo " full-release - Do system, xenocara, system-release, xenocara-release"
1.14 andrew 111: echo
1.1 andrew 112: }
113:
1.14 andrew 114: if [ `whoami` != "root" ]; then
1.19 andrew 115: echo "You must be root to build a release."
1.14 andrew 116: exit 1
117: fi
118:
1.1 andrew 119: START=`date`
120: echo
1.14 andrew 121: echo ".: release.sh - building an OpenBSD release :."
122: echo "----------------------------------------------"
1.1 andrew 123: echo
1.14 andrew 124: echo " Tag: $TAG"
125: echo " Kernel: $KERNEL-$ARCH"
126: echo " Dest: $DEST"
1.1 andrew 127: echo "Release: $RELEASE"
1.25 ! andrew 128: if [ X"$CVSROOT" != X"" ]; then
! 129: echo " Root: $CVSROOT"
! 130: fi
1.1 andrew 131: echo
1.19 andrew 132:
133: if [ $# = 0 ]; then usage; exit 1; fi
1.1 andrew 134:
135: for i in $*
136: do
1.14 andrew 137: case $i in
138: update)
139: update_sources
140: ;;
141: kernel)
142: build_kernel
143: ;;
144: system)
145: build_system
146: ;;
147: system-release)
148: make_system_release
149: ;;
150: xenocara)
151: build_xenocara
152: ;;
153: xenocara-release)
154: make_xenocara_release
1.24 andrew 155: ;;
156: full-release)
157: build_system
158: build_xenocara
159: make_xenocara_release
160: make_system_release
1.14 andrew 161: ;;
162: *)
163: echo "---------- Abort! Abort! ----------"
164: echo "Invalid option encountered: $i"
165: echo "Exiting......."
166: echo
167: exit 1
168: ;;
169: esac
1.1 andrew 170: done
171: echo
1.14 andrew 172: echo " Start Time : $START"
1.1 andrew 173: echo "Finish Time : `date`"
174: echo
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>