generate-release.sh revision 221510
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 221510 2011-05-05 19:17:55Z nwhitehorn $ 21# 22 23mkdir -p $2/usr/src 24set -e # Everything must succeed 25 26svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src 27if [ ! -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 37EOF 38elif [ ! -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 42fi 43 44cd $2/usr/src 45make $MAKE_FLAGS buildworld 46make installworld distribution DESTDIR=$2 47mount -t devfs devfs $2/dev 48trap "umount $2/dev" EXIT # Clean up devfs mount on exit 49 50if [ ! -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 55fi 56 57if [ -d $2/usr/doc ]; then 58 cp /etc/resolv.conf $2/etc/resolv.conf 59 60 # Build ports to build the docs, then build the docs 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 chroot $2 make -C /usr/doc $MAKE_FLAGS 'FORMATS=html html-split txt' URLS_ABSOLUTE=YES 63fi 64 65chroot $2 make -C /usr/src $MAKE_FLAGS buildworld buildkernel 66chroot $2 make -C /usr/src/release obj 67chroot $2 make -C /usr/src/release release 68chroot $2 make -C /usr/src/release install DESTDIR=/R 69 70