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
|
|
|
#
|
2012-01-14 09:57:13 +00:00
|
|
|
# Usage: generate-release.sh [-r revision] svn-branch scratch-dir
|
2011-03-11 16:58:21 +00:00
|
|
|
#
|
|
|
|
# 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)
|
2011-11-15 18:49:27 +00:00
|
|
|
# RELSTRING: optional base name for media images (e.g. FreeBSD-9.0-RC2-amd64)
|
2011-03-11 16:58:21 +00:00
|
|
|
#
|
|
|
|
# Note: Since this requires a chroot, release cross-builds will not work!
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
2012-01-14 09:57:13 +00:00
|
|
|
usage()
|
|
|
|
{
|
2012-09-17 02:23:03 +00:00
|
|
|
echo "Usage: $0 [-r revision] [-d docrevision] [-p portsrevision] svn-branch scratch-dir"
|
2012-01-14 09:57:13 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
REVISION=
|
2012-09-17 02:23:03 +00:00
|
|
|
DOCREVISION=
|
|
|
|
PORTSREVISION=
|
|
|
|
while getopts d:r:p: opt; do
|
2012-01-15 09:27:00 +00:00
|
|
|
case $opt in
|
2012-09-17 02:23:03 +00:00
|
|
|
d)
|
|
|
|
DOCREVISION="-r $OPTARG"
|
|
|
|
;;
|
2012-01-15 09:27:00 +00:00
|
|
|
r)
|
|
|
|
REVISION="-r $OPTARG"
|
2012-01-14 09:57:13 +00:00
|
|
|
;;
|
2012-09-17 02:23:03 +00:00
|
|
|
p)
|
|
|
|
PORTSREVISION="-r $OPTARG"
|
|
|
|
;;
|
2012-01-15 09:27:00 +00:00
|
|
|
\?)
|
|
|
|
usage
|
2012-01-14 09:57:13 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2012-01-15 09:27:00 +00:00
|
|
|
shift $(($OPTIND - 1))
|
2012-01-14 09:57:13 +00:00
|
|
|
|
|
|
|
if [ $# -lt 2 ]; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2011-05-05 19:17:55 +00:00
|
|
|
set -e # Everything must succeed
|
|
|
|
|
2012-01-14 14:43:22 +00:00
|
|
|
case $MAKE_FLAGS in
|
|
|
|
*-j*)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
MAKE_FLAGS="$MAKE_FLAGS -j "$(sysctl -n hw.ncpu)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
mkdir -p $2/usr/src
|
|
|
|
|
2012-01-14 09:57:13 +00:00
|
|
|
svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src $REVISION
|
2012-09-17 02:23:03 +00:00
|
|
|
svn co ${SVNROOT:-svn://svn.freebsd.org/doc}/head $2/usr/doc $DOCREVISION
|
|
|
|
svn co ${SVNROOT:-svn://svn.freebsd.org/ports}/head $2/usr/ports $PORTSREVISION
|
2011-03-11 16:58:21 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2011-03-19 23:06:17 +00:00
|
|
|
if [ -d $2/usr/doc ]; then
|
|
|
|
cp /etc/resolv.conf $2/etc/resolv.conf
|
2011-03-13 15:08:06 +00:00
|
|
|
|
2012-09-17 02:23:03 +00:00
|
|
|
# Install docproj to build release documentation
|
|
|
|
chroot $2 /bin/sh -c '(export ASSUME_ALWAYS_YES=1 && /usr/sbin/pkg install -y docproj) || (cd /usr/ports/textproc/docproj && make install clean BATCH=yes WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=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
|
|
|
|
2011-11-15 18:49:27 +00:00
|
|
|
: ${RELSTRING=`chroot $2 uname -s`-`chroot $2 uname -r`-`chroot $2 uname -p`}
|
|
|
|
|
|
|
|
cd $2/R
|
|
|
|
for i in release.iso bootonly.iso memstick; do
|
|
|
|
mv $i $RELSTRING-$i
|
|
|
|
done
|
|
|
|
sha256 $RELSTRING-* > CHECKSUM.SHA256
|
|
|
|
md5 $RELSTRING-* > CHECKSUM.MD5
|
|
|
|
|