Annotation of openbsd/update_openbsd/release.sh, Revision 1.17
1.1 andrew 1: #!/bin/sh
1.17 ! andrew 2: # $RedRiver: release.sh,v 1.16 2008/02/13 16:47:50 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
1.16 andrew 48: _cvstag=-r$TAG
49: if [ X"$TAG" == X"HEAD" ]; then
1.15 andrew 50: _cvstag=""
1.14 andrew 51: fi
1.17 ! andrew 52: echo "cd $d && cvs -q -z6 update $_cvstag -Pd"
1.14 andrew 53: cd $d && cvs -q -z6 update $_cvstag -Pd
54: done
1.1 andrew 55: }
56:
57: build_kernel() {
1.14 andrew 58: echo "---------- Build and install a new kernel ----------"
59: cd /usr/src/sys/arch/$ARCH/conf
60: config $KERNEL
61: cd ../compile/$KERNEL
62: make clean depend && make
63: cp /bsd /bsd.old && cp bsd /
1.1 andrew 64: }
65:
66: build_system() {
1.14 andrew 67: echo "---------- Build a new system ----------"
68: rm -rf /usr/obj/*
69: cd /usr/src && nice make obj
70: cd /usr/src/etc && export DESTDIR=/ && make distrib-dirs
71: cd /usr/src && nice make build
72: # Update /etc, /var, and /dev/MAKEDEV by hand.
73: }
74:
75: make_system_release() {
76: echo "---------- Make and validate the system release ----------"
77: cd /usr/src/distrib/crunch && make obj depend && make all install
78: export DESTDIR=$DEST; export RELEASEDIR=$RELEASE
79: if (-e $DESTDIR); then
80: mkdir $DESTDIR/old-
81: mv $DESTDIR/* $DESTDIR/old- 2>/dev/null
82: rm -rf $DESTDIR/old- &
83: fi
84: mkdir -p $DESTDIR $RELEASEDIR
85: cd /usr/src/etc && nice make release
86: cd /usr/src/distrib/sets && sh checkflist
87: unset DESTDIR RELEASEDIR
88: }
89:
90: build_xenocara() {
91: echo "---------- Build and install xenocara ----------"
92: rm -rf /usr/xobj/*
93: cd $XSRCDIR
94: make bootstrap
95: make obj
96: make build
97: }
98:
99: make_xenocara_release() {
100: echo "---------- Make and validate the xenocara release ----------"
101: export DESTDIR=$DEST RELEASEDIR=$RELEASE
102: if (-e $DESTDIR); then
103: mkdir $DESTDIR/old-
104: mv $DESTDIR/* $DESTDIR/old- 2>/dev/null
105: rm -rf $DESTDIR/old- &
106: fi
107: mkdir -p $DESTDIR $RELEASEDIR
108: cd $XSRCDIR
109: nice make release
110: unset DESTDIR RELEASEDIR
1.1 andrew 111: }
112:
113: usage() {
1.14 andrew 114: echo " Usage: $0 <options>"
115: echo
116: echo "Options:"
117: echo
118: echo " update - Update sources"
119: echo " kernel - Build and install a new kernel"
120: echo " system - Build a new system"
121: echo " system-release - Make and validate the system release"
122: echo " xenocara - Build and install xenocara"
123: echo " xenocara-release - Make and validate the xenocara release"
124: echo
1.1 andrew 125: }
126:
1.14 andrew 127: if [ $# = 0 ]; then usage; exit 1; fi
128:
129: if [ `whoami` != "root" ]; then
130: echo "You must be root to create a release."
131: exit 1
132: fi
133:
1.1 andrew 134: START=`date`
135: echo
1.14 andrew 136: echo ".: release.sh - building an OpenBSD release :."
137: echo "----------------------------------------------"
1.1 andrew 138: echo
1.14 andrew 139: echo " Tag: $TAG"
140: echo " Kernel: $KERNEL-$ARCH"
141: echo " Dest: $DEST"
1.1 andrew 142: echo "Release: $RELEASE"
143: echo
144:
145: for i in $*
146: do
1.14 andrew 147: case $i in
148: full-release)
149: build_xenocara
150: build_system
151: make_xenocara_release
152: make_system_release
153: ;;
154: update)
155: update_sources
156: ;;
157: kernel)
158: build_kernel
159: ;;
160: system)
161: build_system
162: ;;
163: system-release)
164: make_system_release
165: ;;
166: xenocara)
167: build_xenocara
168: ;;
169: xenocara-release)
170: make_xenocara_release
171: ;;
172: *)
173: echo "---------- Abort! Abort! ----------"
174: echo "Invalid option encountered: $i"
175: echo "Exiting......."
176: echo
177: exit 1
178: ;;
179: esac
1.1 andrew 180: done
181: echo
1.14 andrew 182: echo " Start Time : $START"
1.1 andrew 183: echo "Finish Time : `date`"
184: echo
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>