generate-release.sh revision 219610
1219508Snwhitehorn#!/bin/sh
2219508Snwhitehorn
3219508Snwhitehorn# generate-release.sh: check out source trees, and build release components with
4219610Snwhitehorn#  totally clean, fresh trees.
5219508Snwhitehorn#
6219508Snwhitehorn#  Usage: generate-release.sh svn-branch scratch-dir
7219508Snwhitehorn#
8219508Snwhitehorn# Environment variables:
9219610Snwhitehorn#  CVSUP_HOST: Host of a cvsup server to obtain the ports and documentation
10219610Snwhitehorn#   trees. Must be set to include ports and documentation.
11219610Snwhitehorn#  CVSUP_TAG:  CVS tag for ports and documentation (HEAD by default)
12219508Snwhitehorn#  MAKE_FLAGS: optional flags to pass to make (e.g. -j)
13219508Snwhitehorn# 
14219508Snwhitehorn#  Note: Since this requires a chroot, release cross-builds will not work!
15219508Snwhitehorn#
16219508Snwhitehorn# $FreeBSD: head/release/generate-release.sh 219610 2011-03-13 15:08:06Z nwhitehorn $
17219508Snwhitehorn#
18219508Snwhitehorn
19219508Snwhitehornmkdir -p $2/usr/src
20219508Snwhitehornsvn co svn://svn.freebsd.org/base/$1 $2/usr/src || exit 1
21219508Snwhitehornif [ ! -z $CVSUP_HOST ]; then
22219610Snwhitehorn	cat > $2/docports-supfile << EOF
23219508Snwhitehorn	*default host=$CVSUP_HOST
24219508Snwhitehorn	*default base=/var/db
25219508Snwhitehorn	*default prefix=/usr
26219508Snwhitehorn	*default release=cvs tag=${CVSUP_TAG:-.}
27219508Snwhitehorn	*default delete use-rel-suffix
28219508Snwhitehorn	*default compress
29219508Snwhitehorn	ports-all
30219610Snwhitehorn	doc-all
31219508SnwhitehornEOF
32219508Snwhitehornelse
33219610Snwhitehorn	RELEASE_FLAGS="-DNOPORTS -DNODOC"
34219508Snwhitehornfi
35219508Snwhitehorn
36219508Snwhitehorncd $2/usr/src
37219508Snwhitehornmake $MAKE_FLAGS buildworld || exit 1
38219508Snwhitehornmake installworld distribution DESTDIR=$2 || exit 1
39219508Snwhitehornmount -t devfs devfs $2/dev
40219508Snwhitehorn
41219508Snwhitehornif [ ! -z $CVSUP_HOST ]; then 
42219508Snwhitehorn	cp /etc/resolv.conf $2/etc/resolv.conf
43219610Snwhitehorn
44219610Snwhitehorn	# Checkout ports and doc trees
45219610Snwhitehorn	#chroot $2 /usr/bin/csup /docports-supfile || exit 1
46219610Snwhitehorn
47219610Snwhitehorn	# Build ports to build the docs, then build the docs
48219610Snwhitehorn	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)' || exit 1
49219610Snwhitehorn	chroot $2 /bin/sh -c "cd /usr/doc && make $MAKE_FLAGS 'FORMATS=html html-split txt' URLS_ABSOLUTE=YES" || exit 1
50219508Snwhitehornfi
51219610Snwhitehorn
52219508Snwhitehornchroot $2 /bin/sh -c "cd /usr/src && make $MAKE_FLAGS buildworld buildkernel" || exit 1
53219508Snwhitehornmkdir $2/R
54219508Snwhitehornchroot $2 /bin/sh -c "cd /usr/src/release && MAKEOBJDIR=/R make -f Makefile.bsdinstall release $RELEASE_FLAGS" || exit 1
55219508Snwhitehorn
56