[Midnightbsd-cvs] src [11840] trunk/release/generate-release.sh: update script

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Jul 12 20:37:44 EDT 2018


Revision: 11840
          http://svnweb.midnightbsd.org/src/?rev=11840
Author:   laffer1
Date:     2018-07-12 20:37:43 -0400 (Thu, 12 Jul 2018)
Log Message:
-----------
update script

Modified Paths:
--------------
    trunk/release/generate-release.sh

Property Changed:
----------------
    trunk/release/generate-release.sh

Modified: trunk/release/generate-release.sh
===================================================================
--- trunk/release/generate-release.sh	2018-07-13 00:33:30 UTC (rev 11839)
+++ trunk/release/generate-release.sh	2018-07-13 00:37:43 UTC (rev 11840)
@@ -1,72 +1,126 @@
 #!/bin/sh
-+#-
-+# Copyright (c) 2011 Nathan Whitehorn
-+# All rights reserved.
-+#
-+# Redistribution and use in source and binary forms, with or without
-+# modification, are permitted provided that the following conditions
-+# are met:
-+# 1. Redistributions of source code must retain the above copyright
-+#    notice, this list of conditions and the following disclaimer.
-+# 2. Redistributions in binary form must reproduce the above copyright
-+#    notice, this list of conditions and the following disclaimer in the
-+#    documentation and/or other materials provided with the distribution.
-+#
-+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+# SUCH DAMAGE.
-+#
+#-
+# Copyright (c) 2011 Nathan Whitehorn
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $MidnightBSD$
+#
 
 # generate-release.sh: check out source trees, and build release components with
 #  totally clean, fresh trees.
 #
-#  Usage: generate-release.sh cvs-branch scratch-dir
+#  Usage: generate-release.sh svn-branch[@revision] scratch-dir
 #
 # Environment variables:
-#  CVSROOT:    CVS root to obtain the mports tree.
-#  CVS_TAG:    CVS tag for mports (HEAD by default)
-#  MAKE_FLAGS: optional flags to pass to make (e.g. -j)
-#  RELSTRING:  optional base name for media images (e.g. MidnightBSD-0.4-RC2-amd64)
-# 
-#  Note: Since this requires a chroot, release cross-builds will not work!
+#  SVNROOTBASE: SVN base URL to MidnightBSD repository (svn://svn.midnightbsd.org)
+#  SVNROOTSRC:  URL to MidnightBSD src tree (${SVNROOTBASE}/base)
+#  SVNROOTDOC:  URL to MidnightBSD doc tree (${SVNROOTBASE}/doc)
+#  SVNROOTPORTS:URL to MidnightBSD mports tree (${SVNROOTBASE}/mports)
+#  BRANCHSRC:   branch name of src (svn-branch[@revision])
+#  BRANCHDOC:   branch name of doc (trunk)
+#  BRANCHPORTS: branch name of mports (trunk)
+#  WORLD_FLAGS: optional flags to pass to buildworld (e.g. -j)
+#  KERNEL_FLAGS: optional flags to pass to buildkernel (e.g. -j)
 #
-# $MidnightBSD: src/release/generate-release.sh,v 1.1 2011/12/02 13:15:35 laffer1 Exp $
-# $FreeBSD: src/release/generate-release.sh,v 1.14 2011/11/15 18:49:27 nwhitehorn Exp $
-#
 
-mkdir -p $2/usr/src
-set -e # Everything must succeed
+usage()
+{
+	echo "Usage: $0 svn-branch[@revision] scratch-dir" 2>&1
+	exit 1
+}
 
-if [ ! -z $CVSROOT ]; then
-	cd $2/usr
-	cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} mports
-	cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r $1 src
+if [ $# -lt 2 ]; then
+	usage
 fi
 
-cd $2/usr/src
-make $MAKE_FLAGS buildworld
-make installworld distribution DESTDIR=$2
-mount -t devfs devfs $2/dev
-trap "umount $2/dev" EXIT # Clean up devfs mount on exit
+: ${SVNROOTBASE:=svn://svn.midnightbsd.org/svn/}
+: ${SVNROOTSRC:=${SVNROOTBASE}/src}
+: ${SVNROOTDOC:=${SVNROOTBASE}/doc}
+: ${SVNROOTPORTS:=${SVNROOTBASE}/mports}
+: ${SVNROOT:=${SVNROOTSRC}} # for backward compatibility
+: ${SVN_CMD:=/usr/local/bin/svn}
+BRANCHSRC=$1
+: ${BRANCHDOC:=trunk}
+: ${BRANCHPORTS:=trunk}
+: ${WORLD_FLAGS:=${MAKE_FLAGS}}
+: ${KERNEL_FLAGS:=${MAKE_FLAGS}}
+: ${CHROOTDIR:=$2}
+ 
+if [ ! -r "${CHROOTDIR}" ]; then
+	echo "${CHROOTDIR}: scratch dir not found."
+	exit 1
+fi
 
-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
+CHROOT_CMD="/usr/sbin/chroot ${CHROOTDIR}"
+case ${TARGET} in
+"")	;;
+*)	SETENV_TARGET="TARGET=$TARGET" ;;
+esac
+case ${TARGET_ARCH} in
+"")	;;
+*)	SETENV_TARGET_ARCH="TARGET_ARCH=$TARGET_ARCH" ;;
+esac
+SETENV="env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin"
+CROSSENV="${SETENV_TARGET} ${SETENV_TARGET_ARCH}"
+WMAKE="make -C /usr/src ${WORLD_FLAGS}"
+NWMAKE="${WMAKE} __MAKE_CONF=/dev/null SRCCONF=/dev/null"
+KMAKE="make -C /usr/src ${KERNEL_FLAGS}"
+RMAKE="make -C /usr/src/release"
 
-: ${RELSTRING=`chroot $2 uname -s`-`chroot $2 uname -r`-`chroot $2 uname -p`}
+if [ $(id -u) -ne 0 ]; then
+	echo "Needs to be run as root."
+	exit 1
+fi
 
-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
+set -e # Everything must succeed
 
+mkdir -p ${CHROOTDIR}/usr/src
+${SVN_CMD} co ${SVNROOT}/${BRANCHSRC} ${CHROOTDIR}/usr/src
+${SVN_CMD} co ${SVNROOTDOC}/${BRANCHDOC} ${CHROOTDIR}/usr/doc
+${SVN_CMD} co ${SVNROOTPORTS}/${BRANCHPORTS} ${CHROOTDIR}/usr/mports
+
+${SETENV} ${NWMAKE} -C ${CHROOTDIR}/usr/src ${WORLD_FLAGS} buildworld
+${SETENV} ${NWMAKE} -C ${CHROOTDIR}/usr/src installworld distribution DESTDIR=${CHROOTDIR}
+mount -t devfs devfs ${CHROOTDIR}/dev
+trap "umount ${CHROOTDIR}/dev" EXIT # Clean up devfs mount on exit
+
+if [ -d ${CHROOTDIR}/usr/doc ]; then 
+	cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf
+
+	# Install docproj to build release documentation
+	${CHROOT_CMD} /etc/rc.d/ldconfig forcerestart
+	${CHROOT_CMD} /bin/sh -c \
+		'make -C /usr/mports/textproc/docproj \
+			BATCH=yes \
+			WITHOUT_SVN=yes \
+			WITHOUT_JADETEX=yes \
+			WITHOUT_X11=yes \
+			WITHOUT_PYTHON=yes \
+			install'
+fi
+
+${CHROOT_CMD} ${SETENV} ${CROSSENV} ${WMAKE} buildworld
+${CHROOT_CMD} ${SETENV} ${CROSSENV} ${KMAKE} buildkernel
+${CHROOT_CMD} ${SETENV} ${CROSSENV} ${RMAKE} release
+${CHROOT_CMD} ${SETENV} ${CROSSENV} ${RMAKE} install DESTDIR=/R


Property changes on: trunk/release/generate-release.sh
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list