]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - release/generate-release.sh
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / release / generate-release.sh
1 #!/bin/sh
2
3 # generate-release.sh: check out source trees, and build release components with
4 #  totally clean, fresh trees.
5 #
6 #  Usage: generate-release.sh svn-branch scratch-dir
7 #
8 # Environment variables:
9 #  CVSUP_HOST: Host of a cvsup server to obtain the ports and documentation
10 #   trees. This or CVSROOT must be set to include ports and documentation.
11 #  CVSROOT:    CVS root to obtain the ports and documentation trees. This or
12 #   CVSUP_HOST must be set to include ports and documentation.
13 #  CVS_TAG:    CVS tag for ports and documentation (HEAD by default)
14 #  SVNROOT:    SVN URL to FreeBSD source repository (by default, 
15 #   svn://svn.freebsd.org/base)
16 #  MAKE_FLAGS: optional flags to pass to make (e.g. -j)
17
18 #  Note: Since this requires a chroot, release cross-builds will not work!
19 #
20 # $FreeBSD$
21 #
22
23 mkdir -p $2/usr/src
24 set -e # Everything must succeed
25
26 svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src
27 if [ ! -z $CVSUP_HOST ]; then
28         cat > $2/docports-supfile << EOF
29         *default host=$CVSUP_HOST
30         *default base=/var/db
31         *default prefix=/usr
32         *default release=cvs tag=${CVS_TAG:-.}
33         *default delete use-rel-suffix
34         *default compress
35         ports-all
36         doc-all
37 EOF
38 elif [ ! -z $CVSROOT ]; then
39         cd $2/usr
40         cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} ports
41         cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} doc
42 fi
43
44 cd $2/usr/src
45 make $MAKE_FLAGS buildworld
46 make installworld distribution DESTDIR=$2
47 mount -t devfs devfs $2/dev
48 trap "umount $2/dev" EXIT # Clean up devfs mount on exit
49
50 if [ ! -z $CVSUP_HOST ]; then 
51         cp /etc/resolv.conf $2/etc/resolv.conf
52
53         # Checkout ports and doc trees
54         chroot $2 /usr/bin/csup /docports-supfile
55 fi
56
57 if [ -d $2/usr/doc ]; then 
58         cp /etc/resolv.conf $2/etc/resolv.conf
59
60         # Build ports to build release documentation
61         chroot $2 /bin/sh -c 'pkg_add -r docproj || (cd /usr/ports/textproc/docproj && make install clean BATCH=yes WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes)'
62 fi
63
64 chroot $2 make -C /usr/src $MAKE_FLAGS buildworld buildkernel
65 chroot $2 make -C /usr/src/release release
66 chroot $2 make -C /usr/src/release install DESTDIR=/R
67