Annotation of openbsd/update_openbsd/release.sh, Revision 1.8
1.1 andrew 1: #!/bin/sh
1.8 ! andrew 2: # $RedRiver: release.sh,v 1.7 2006/11/07 17:32:10 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.8 ! andrew 41: CVSTAG=${CVSTAG:=`uname -r | awk '{ sub("\\\.","_"); print "OPENBSD_" $0 }'`}
1.2 andrew 42: #SOURCES="src ports XF4"
1.6 andrew 43: #SOURCES="src ports"
44: SOURCES="src XF4"
1.1 andrew 45:
46: # Anonymous CVS - http://www.openbsd.org/anoncvs.html
1.2 andrew 47: CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs"
1.1 andrew 48: export CVSROOT
49:
50: install_sources() {
51: echo "********** Install sources **********"
52: cd /usr
1.2 andrew 53: for d in $SOURCES; do
54: rm -rf $d/*
55: cvs -q -z6 checkout -r$CVSTAG -P $d
56: done
1.1 andrew 57: }
58:
59: update_sources() {
60: echo "********** Update sources **********"
1.2 andrew 61: for d in $SOURCES; do
1.8 ! andrew 62: _cvstag=-r$CVSTAG
! 63: if [ X"$CVSTAG" == X"HEAD" ]; then
! 64: _cvstag=-A
! 65: fi
! 66: cd /usr && cvs -q -z6 update $_cvstag -Pd $d
1.2 andrew 67: done
1.1 andrew 68: }
69:
70: build_kernel() {
71: echo "********** Build and install a new kernel **********"
72: cd /usr/src/sys/arch/i386/conf
73: config GENERIC
74: cd ../compile/GENERIC
75: make clean depend && make
76: cp /bsd /bsd.old && cp bsd /
77: }
78:
79: build_system() {
80: echo "********** Build a new system **********"
81: rm -rf /usr/obj/*
82: cd /usr/src && nice make obj
83: cd /usr/src/etc && export DESTDIR=/ && make distrib-dirs
84: cd /usr/src && nice make build
85: }
86:
87: make_release() {
88: echo "********** Make and validate the system release **********"
89: cd /usr/src/distrib/crunch && make obj depend all install
90: export DESTDIR=$DEST RELEASEDIR=$RELEASE
1.4 andrew 91: rm -rf $DESTDIR/*
1.1 andrew 92: mkdir -p $DESTDIR $RELEASEDIR
93: cd /usr/src/etc && nice make release
94: cd /usr/src/distrib/sets && sh checkflist
1.7 andrew 95: ls $RELEASEDIR | grep -v index.txt | sort > $RELEASEDIR/index.txt
1.1 andrew 96: unset DESTDIR RELEASEDIR
97: }
98:
99: build_XF4() {
100: echo "********** Build and install XF4 **********"
101: rm -rf /usr/Xbuild
102: mkdir -p /usr/Xbuild
103: cd /usr/ports/lang/tcl/8.4 && make install
104: cd /usr/ports/x11/tk/8.4 && make install
105: cd /usr/Xbuild && lndir /usr/XF4 && nice make build
106: }
107:
108: make_release_XF4() {
109: echo "********** Make and validate the XF4 release **********"
110: export DESTDIR=$DEST RELEASEDIR=$RELEASE
1.6 andrew 111: rm -rf $DESTDIR/*
1.1 andrew 112: mkdir -p $DESTDIR $RELEASEDIR
1.6 andrew 113: cd /usr/Xbuild && nice make release
114: cd /usr/Xbuild/distrib/sets && sh checkflist
1.7 andrew 115: ls $RELEASEDIR | grep -v index.txt | sort > $RELEASEDIR/index.txt
1.1 andrew 116: unset DESTDIR RELEASEDIR
117: }
118:
119: clean_everything() {
120: echo "********** Clean everything **********"
1.6 andrew 121: rm -rf /usr/obj/* $DEST/* /usr/Xbuild
1.1 andrew 122: }
123:
124: usage() {
125: echo "Usage: $0 options"
126: echo
127: echo "Options:"
128: echo
129: echo " install - Install sources"
130: echo " update - Update sources"
131: echo " kernel - Build and install a new kernel"
132: echo " system - Build a new system"
133: echo " release - Make and validate the system release"
134: echo " xwindow - Build and install XF4"
135: echo " xwindow-release - Make and validate the XF4 release"
136: echo " clean - Clean everything"
137: echo
138: }
139:
140: if [ `whoami` != "root" ]; then
141: echo "You probably should be root instead of `whoami` to run this safely."
142: exit 1
143: fi
144:
145: START=`date`
146: echo
147: echo "***** OpenBSD - Release Building *****"
148: echo
149: echo "Dest: $DEST"
150: echo "Release: $RELEASE"
151: echo "CVS Server: $CVSROOT"
152: echo "CVS Revision Tag: $CVSTAG"
153: echo
154:
155: if [ $# = 0 ]; then usage; exit 1; fi
156:
157: for i in $*
158: do
159: case $i in
160: install)
161: install_sources
162: ;;
163: update)
164: update_sources
165: ;;
166: kernel)
167: build_kernel
168: ;;
169: system)
170: build_system
171: ;;
172: release)
173: make_release
174: ;;
175: xwindow)
176: build_XF4
177: ;;
178: xwindow-release)
179: make_release_XF4
180: ;;
181: clean)
182: clean_everything
183: ;;
184: *)
185: echo "********** Abort! Abort! **********"
186: echo "Invalid option encountered: $i"
187: echo "Exiting......."
188: echo
189: exit 1
190: ;;
191: esac
192: done
193: echo
194: echo "Start Time : $START"
195: echo "Finish Time : `date`"
196: echo
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>