generate-release.sh revision 220540
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: head/release/generate-release.sh 220540 2011-04-11 14:30:45Z nwhitehorn $ 21# 22 23mkdir -p $2/usr/src 24svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src || exit 1 25if [ ! -z $CVSUP_HOST ]; then 26 cat > $2/docports-supfile << EOF 27 *default host=$CVSUP_HOST 28 *default base=/var/db 29 *default prefix=/usr 30 *default release=cvs tag=${CVS_TAG:-.} 31 *default delete use-rel-suffix 32 *default compress 33 ports-all 34 doc-all 35EOF 36elif [ ! -z $CVSROOT ]; then 37 cd $2/usr 38 cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} ports || exit 1 39 cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} doc || exit 1 40fi 41 42cd $2/usr/src 43make $MAKE_FLAGS buildworld || exit 1 44make installworld distribution DESTDIR=$2 || exit 1 45mount -t devfs devfs $2/dev 46 47if [ ! -z $CVSUP_HOST ]; then 48 cp /etc/resolv.conf $2/etc/resolv.conf 49 50 # Checkout ports and doc trees 51 chroot $2 /usr/bin/csup /docports-supfile || exit 1 52fi 53 54if [ -d $2/usr/doc ]; then 55 cp /etc/resolv.conf $2/etc/resolv.conf 56 57 # Build ports to build the docs, then build the docs 58 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 59 chroot $2 /bin/sh -c "cd /usr/doc && make $MAKE_FLAGS 'FORMATS=html html-split txt' URLS_ABSOLUTE=YES" || exit 1 60fi 61 62chroot $2 /bin/sh -c "cd /usr/src && make $MAKE_FLAGS buildworld buildkernel" || exit 1 63chroot $2 /bin/sh -c "cd /usr/src/release && make release install DESTDIR=/R" || exit 1 64 65