Annotation of openbsd/update_openbsd/release.sh, Revision 1.27
1.1 andrew 1: #!/bin/sh
1.27 ! andrew 2: # $RedRiver: release.sh,v 1.26 2008/11/03 18:58:23 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.27 ! andrew 28: if [ -e /etc/release.conf ]; then
! 29: . /etc/release.conf
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.26 andrew 74: if [ X"$DESTDIR" == X"" ]; then
75: echo PLEASE SET \$DEST! >2&
76: exit
77: fi
1.25 andrew 78: rm -rf $DESTDIR/* $DESTDIR/.*
1.14 andrew 79: mkdir -p $DESTDIR $RELEASEDIR
80: cd /usr/src/etc && nice make release
81: cd /usr/src/distrib/sets && sh checkflist
82: unset DESTDIR RELEASEDIR
83: }
84:
85: build_xenocara() {
86: echo "---------- Build and install xenocara ----------"
87: cd $XSRCDIR
88: make bootstrap
89: make obj
90: make build
91: }
92:
93: make_xenocara_release() {
94: echo "---------- Make and validate the xenocara release ----------"
95: export DESTDIR=$DEST RELEASEDIR=$RELEASE
1.26 andrew 96: if [ X"$DESTDIR" == X"" ]; then
97: echo PLEASE SET \$DEST! >2&
98: exit
99: fi
100: rm -rf $DESTDIR/* $DESTDIR/.*
1.14 andrew 101: mkdir -p $DESTDIR $RELEASEDIR
102: cd $XSRCDIR
103: nice make release
104: unset DESTDIR RELEASEDIR
1.1 andrew 105: }
106:
107: usage() {
1.14 andrew 108: echo " Usage: $0 <options>"
109: echo
110: echo "Options:"
111: echo
112: echo " update - Update sources"
113: echo " kernel - Build and install a new kernel"
114: echo " system - Build a new system"
115: echo " system-release - Make and validate the system release"
116: echo " xenocara - Build and install xenocara"
117: echo " xenocara-release - Make and validate the xenocara release"
1.19 andrew 118: echo " full-release - Do system, xenocara, system-release, xenocara-release"
1.14 andrew 119: echo
1.1 andrew 120: }
121:
1.14 andrew 122: if [ `whoami` != "root" ]; then
1.19 andrew 123: echo "You must be root to build a release."
1.14 andrew 124: exit 1
125: fi
126:
1.1 andrew 127: START=`date`
128: echo
1.14 andrew 129: echo ".: release.sh - building an OpenBSD release :."
130: echo "----------------------------------------------"
1.1 andrew 131: echo
1.14 andrew 132: echo " Tag: $TAG"
133: echo " Kernel: $KERNEL-$ARCH"
134: echo " Dest: $DEST"
1.1 andrew 135: echo "Release: $RELEASE"
1.25 andrew 136: if [ X"$CVSROOT" != X"" ]; then
137: echo " Root: $CVSROOT"
138: fi
1.1 andrew 139: echo
1.19 andrew 140:
141: if [ $# = 0 ]; then usage; exit 1; fi
1.1 andrew 142:
143: for i in $*
144: do
1.14 andrew 145: case $i in
146: update)
147: update_sources
148: ;;
149: kernel)
150: build_kernel
151: ;;
152: system)
153: build_system
154: ;;
155: system-release)
156: make_system_release
157: ;;
158: xenocara)
159: build_xenocara
160: ;;
161: xenocara-release)
162: make_xenocara_release
1.24 andrew 163: ;;
164: full-release)
165: build_system
166: build_xenocara
167: make_xenocara_release
168: make_system_release
1.14 andrew 169: ;;
170: *)
171: echo "---------- Abort! Abort! ----------"
172: echo "Invalid option encountered: $i"
173: echo "Exiting......."
174: echo
175: exit 1
176: ;;
177: esac
1.1 andrew 178: done
179: echo
1.14 andrew 180: echo " Start Time : $START"
1.1 andrew 181: echo "Finish Time : `date`"
182: echo
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>