Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Feb 2015 22:27:03 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279257 - in head/release: . tools
Message-ID:  <201502242227.t1OMR3UT074096@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Tue Feb 24 22:27:02 2015
New Revision: 279257
URL: https://svnweb.freebsd.org/changeset/base/279257

Log:
  Add a CLOUDPACKAGE variable to contain a list of targets for
  post-install packaging cloud provider images.
  
  Add a 'gce-package.sh' script to generate the final output
  image ready for upload to the GCE platform.  Right now, this
  is the only image that has a specific output format (GNU-tar),
  and this implementation is expected to be temporary.
  
  This is not directly connected to the other release targets.
  
  MFC after:	1 week
  X-MFC-with:	r279249, r279250
  Sponsored by:	The FreeBSD Foundation

Added:
  head/release/tools/gce-package.sh   (contents, props changed)
Modified:
  head/release/Makefile.vm

Modified: head/release/Makefile.vm
==============================================================================
--- head/release/Makefile.vm	Tue Feb 24 22:22:06 2015	(r279256)
+++ head/release/Makefile.vm	Tue Feb 24 22:27:02 2015	(r279257)
@@ -34,8 +34,10 @@ CLOUDTARGETS+=	cw-${_CW:tl}
 CLEANDIRS+=	cw-${_CW:tl}
 CLEANFILES+=	${_CW:tl}.img \
 		${_CW:tl}.${${_CW:tu}_FORMAT} \
-		${_CW:tl}.${${_CW:tu}_FORMAT}.raw
+		${_CW:tl}.${${_CW:tu}_FORMAT}.raw \
+		cw${_CW:tl}-package
 CLOUDINSTALL+=	cw${_CW:tl}-install
+CLOUDPACKAGE+=	cw${_CW:tl}-package
 ${_CW:tu}IMAGE=	${_CW:tl}.${${_CW:tu}_FORMAT}
 .  if exists(${.CURDIR}/tools/${_CW:tl}.conf) && !defined(${_CW:tu}CONF)
 ${_CW:tu}CONF?=	${.CURDIR}/tools/${_CW:tl}.conf
@@ -59,6 +61,16 @@ cw${_CW:tl}-install:
 	cd ${DESTDIR}/${_CW:tl} && md5 ${${_CW}_DISK}* > \
 		${DESTDIR}/${_CW:tl}/CHECKSUM.MD5
 
+cw${_CW:tl}-package:
+	@# Special target to handle packaging cloud images in the formats
+	@# specific to each hosting provider.
+.if exists(${.CURDIR}/tools/${_CW:tl}-package.sh)
+	env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
+		${.CURDIR}/tools/${_CW:tl}-package.sh \
+		-D ${DESTDIR} -I ${${_CW}_DISK} -S ${WORLDDIR}
+.endif
+	touch ${.TARGET}
+
 . endfor
 .endif
 

Added: head/release/tools/gce-package.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/release/tools/gce-package.sh	Tue Feb 24 22:27:02 2015	(r279257)
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# Script to handle packaging cloud images for GCE.
+#
+# XXX:
+# This script only exists to help in automating image creation,
+# and reimplementing this is intended (in other words, this is
+# temporary).
+
+usage() {
+	echo "Usage:"
+	echo "$(basename ${0}) -D <destdir> -I <input_file> -S <src_tree>"
+	exit 1
+}
+
+main() {
+	while getopts "D:I:W:" opt; do
+		case ${opt} in
+			D)
+				DESTDIR="${OPTARG}"
+				;;
+			I)
+				INFILE="${OPTARG}"
+				;;
+			S)
+				WORLDDIR="${OPTARG}"
+				;;
+			*)
+				usage
+				;;
+		esac
+	done
+	shift $(( ${OPTIND} - 1 ))
+
+	if [ -z "${DESTDIR}" -o -z "${INFILE}" -o -z "${WORLDDIR}" ]; then
+		usage
+	fi
+
+	OUTFILE="$(make -C ${WORLDDIR}/release -V OSRELEASE).tar.gz"
+
+	cd ${DESTDIR} && tar --format=gnutar -zcf ${OUTFILE} ${INFILE}
+}
+
+main "$@"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502242227.t1OMR3UT074096>