2011-03-11 16:58:21 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# generate-release.sh: check out source trees, and build release components with
|
2011-03-13 15:08:06 +00:00
|
|
|
# totally clean, fresh trees.
|
2011-03-11 16:58:21 +00:00
|
|
|
#
|
|
|
|
# Usage: generate-release.sh svn-branch scratch-dir
|
|
|
|
#
|
|
|
|
# Environment variables:
|
2011-03-13 15:08:06 +00:00
|
|
|
# CVSUP_HOST: Host of a cvsup server to obtain the ports and documentation
|
2011-03-19 23:06:17 +00:00
|
|
|
# trees. This or CVSROOT must be set to include ports and documentation.
|
|
|
|
# CVSROOT: CVS root to obtain the ports and documentation trees. This or
|
|
|
|
# CVSUP_HOST must be set to include ports and documentation.
|
|
|
|
# CVS_TAG: CVS tag for ports and documentation (HEAD by default)
|
|
|
|
# SVNROOT: SVN URL to FreeBSD source repository (by default,
|
|
|
|
# svn://svn.freebsd.org/base)
|
2011-03-11 16:58:21 +00:00
|
|
|
# MAKE_FLAGS: optional flags to pass to make (e.g. -j)
|
|
|
|
#
|
|
|
|
# Note: Since this requires a chroot, release cross-builds will not work!
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
mkdir -p $2/usr/src
|
2011-05-05 19:17:55 +00:00
|
|
|
set -e # Everything must succeed
|
|
|
|
|
|
|
|
svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src
|
2011-03-11 16:58:21 +00:00
|
|
|
if [ ! -z $CVSUP_HOST ]; then
|
2011-03-13 15:08:06 +00:00
|
|
|
cat > $2/docports-supfile << EOF
|
2011-03-11 16:58:21 +00:00
|
|
|
*default host=$CVSUP_HOST
|
|
|
|
*default base=/var/db
|
|
|
|
*default prefix=/usr
|
2011-03-19 23:06:17 +00:00
|
|
|
*default release=cvs tag=${CVS_TAG:-.}
|
2011-03-11 16:58:21 +00:00
|
|
|
*default delete use-rel-suffix
|
|
|
|
*default compress
|
|
|
|
ports-all
|
2011-03-13 15:08:06 +00:00
|
|
|
doc-all
|
2011-03-11 16:58:21 +00:00
|
|
|
EOF
|
2011-03-19 23:06:17 +00:00
|
|
|
elif [ ! -z $CVSROOT ]; then
|
|
|
|
cd $2/usr
|
2011-05-05 19:17:55 +00:00
|
|
|
cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} ports
|
|
|
|
cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} doc
|
2011-03-11 16:58:21 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
cd $2/usr/src
|
2011-05-05 19:17:55 +00:00
|
|
|
make $MAKE_FLAGS buildworld
|
|
|
|
make installworld distribution DESTDIR=$2
|
2011-03-11 16:58:21 +00:00
|
|
|
mount -t devfs devfs $2/dev
|
2011-05-05 19:17:55 +00:00
|
|
|
trap "umount $2/dev" EXIT # Clean up devfs mount on exit
|
2011-03-11 16:58:21 +00:00
|
|
|
|
|
|
|
if [ ! -z $CVSUP_HOST ]; then
|
|
|
|
cp /etc/resolv.conf $2/etc/resolv.conf
|
2011-03-13 15:08:06 +00:00
|
|
|
|
|
|
|
# Checkout ports and doc trees
|
2011-05-05 19:17:55 +00:00
|
|
|
chroot $2 /usr/bin/csup /docports-supfile
|
2011-03-19 23:06:17 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d $2/usr/doc ]; then
|
|
|
|
cp /etc/resolv.conf $2/etc/resolv.conf
|
2011-03-13 15:08:06 +00:00
|
|
|
|
|
|
|
# Build ports to build the docs, then build the docs
|
2011-05-05 19:17:55 +00:00
|
|
|
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)'
|
|
|
|
chroot $2 make -C /usr/doc $MAKE_FLAGS 'FORMATS=html html-split txt' URLS_ABSOLUTE=YES
|
2011-03-11 16:58:21 +00:00
|
|
|
fi
|
2011-03-13 15:08:06 +00:00
|
|
|
|
2011-05-05 19:17:55 +00:00
|
|
|
chroot $2 make -C /usr/src $MAKE_FLAGS buildworld buildkernel
|
|
|
|
chroot $2 make -C /usr/src/release release
|
|
|
|
chroot $2 make -C /usr/src/release install DESTDIR=/R
|
2011-03-11 16:58:21 +00:00
|
|
|
|