Annotation of openbsd/update_openbsd/release.sh, Revision 1.15
1.1 andrew 1: #!/bin/sh
1.15 ! andrew 2: # $RedRiver: release.sh,v 1.14 2007/11/20 20:08:31 andrew Exp $
1.1 andrew 3: #
1.14 andrew 4: # Copyright (c) 2002 - 2007 Steven Roberts <fenderq@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:
19: #TAG="OPENBSD_4_2"
20: KERNEL="GENERIC"
21: ARCH="i386"
22: DEST="/home/destdir"
23: RELEASE="/home/releasedir"
24: XSRCDIR="/usr/src/xenocara"
25: PORTSPATH="/usr/ports"
1.1 andrew 26:
1.2 andrew 27: DEST="/usr/dest"
28: RELEASE="/usr/release"
1.14 andrew 29: TAG=${TAG:=`uname -sr | tr '[:lower:] .' '[:upper:]_'`}
30: ARCH=`machine`
1.2 andrew 31: #SOURCES="src ports XF4"
1.6 andrew 32: #SOURCES="src ports"
1.14 andrew 33: SOURCES="/usr/src $XSRCDIR $PORTSPATH"
1.1 andrew 34:
35: # Anonymous CVS - http://www.openbsd.org/anoncvs.html
1.13 andrew 36: #CVSROOT="anoncvs@anoncvs3.usa.openbsd.org:/cvs"
37: #CVSROOT="anoncvs@anoncvs1.usa.openbsd.org:/cvs"
38: CVSROOT="anoncvs@rt.fm:/cvs"
1.1 andrew 39: export CVSROOT
40:
1.14 andrew 41:
42: # See http://www.openbsd.org/anoncvs.html for instructions on fetching the
43: # sources for the first time.
1.1 andrew 44:
45: update_sources() {
1.14 andrew 46: echo "---------- Update sources ----------"
47: for d in $SOURCES; do
48: _cvstag=-r$CVSTAG
49: if [ X"$CVSTAG" == X"HEAD" ]; then
1.15 ! andrew 50: _cvstag=""
1.14 andrew 51: fi
52: cd $d && cvs -q -z6 update $_cvstag -Pd
53: done
1.1 andrew 54: }
55:
56: build_kernel() {
1.14 andrew 57: echo "---------- Build and install a new kernel ----------"
58: cd /usr/src/sys/arch/$ARCH/conf
59: config $KERNEL
60: cd ../compile/$KERNEL
61: make clean depend && make
62: cp /bsd /bsd.old && cp bsd /
1.1 andrew 63: }
64:
65: build_system() {
1.14 andrew 66: echo "---------- Build a new system ----------"
67: rm -rf /usr/obj/*
68: cd /usr/src && nice make obj
69: cd /usr/src/etc && export DESTDIR=/ && make distrib-dirs
70: cd /usr/src && nice make build
71: # Update /etc, /var, and /dev/MAKEDEV by hand.
72: }
73:
74: make_system_release() {
75: echo "---------- Make and validate the system release ----------"
76: cd /usr/src/distrib/crunch && make obj depend && make all install
77: export DESTDIR=$DEST; export RELEASEDIR=$RELEASE
78: if (-e $DESTDIR); then
79: mkdir $DESTDIR/old-
80: mv $DESTDIR/* $DESTDIR/old- 2>/dev/null
81: rm -rf $DESTDIR/old- &
82: fi
83: mkdir -p $DESTDIR $RELEASEDIR
84: cd /usr/src/etc && nice make release
85: cd /usr/src/distrib/sets && sh checkflist
86: unset DESTDIR RELEASEDIR
87: }
88:
89: build_xenocara() {
90: echo "---------- Build and install xenocara ----------"
91: rm -rf /usr/xobj/*
92: cd $XSRCDIR
93: make bootstrap
94: make obj
95: make build
96: }
97:
98: make_xenocara_release() {
99: echo "---------- Make and validate the xenocara release ----------"
100: export DESTDIR=$DEST RELEASEDIR=$RELEASE
101: if (-e $DESTDIR); then
102: mkdir $DESTDIR/old-
103: mv $DESTDIR/* $DESTDIR/old- 2>/dev/null
104: rm -rf $DESTDIR/old- &
105: fi
106: mkdir -p $DESTDIR $RELEASEDIR
107: cd $XSRCDIR
108: nice make release
109: unset DESTDIR RELEASEDIR
1.1 andrew 110: }
111:
112: usage() {
1.14 andrew 113: echo " Usage: $0 <options>"
114: echo
115: echo "Options:"
116: echo
117: echo " update - Update sources"
118: echo " kernel - Build and install a new kernel"
119: echo " system - Build a new system"
120: echo " system-release - Make and validate the system release"
121: echo " xenocara - Build and install xenocara"
122: echo " xenocara-release - Make and validate the xenocara release"
123: echo
1.1 andrew 124: }
125:
1.14 andrew 126: if [ $# = 0 ]; then usage; exit 1; fi
127:
128: if [ `whoami` != "root" ]; then
129: echo "You must be root to create a release."
130: exit 1
131: fi
132:
1.1 andrew 133: START=`date`
134: echo
1.14 andrew 135: echo ".: release.sh - building an OpenBSD release :."
136: echo "----------------------------------------------"
1.1 andrew 137: echo
1.14 andrew 138: echo " Tag: $TAG"
139: echo " Kernel: $KERNEL-$ARCH"
140: echo " Dest: $DEST"
1.1 andrew 141: echo "Release: $RELEASE"
142: echo
143:
144: for i in $*
145: do
1.14 andrew 146: case $i in
147: full-release)
148: build_xenocara
149: build_system
150: make_xenocara_release
151: make_system_release
152: ;;
153: update)
154: update_sources
155: ;;
156: kernel)
157: build_kernel
158: ;;
159: system)
160: build_system
161: ;;
162: system-release)
163: make_system_release
164: ;;
165: xenocara)
166: build_xenocara
167: ;;
168: xenocara-release)
169: make_xenocara_release
170: ;;
171: *)
172: echo "---------- Abort! Abort! ----------"
173: echo "Invalid option encountered: $i"
174: echo "Exiting......."
175: echo
176: exit 1
177: ;;
178: esac
1.1 andrew 179: done
180: echo
1.14 andrew 181: echo " Start Time : $START"
1.1 andrew 182: echo "Finish Time : `date`"
183: echo
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>