summaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2015-03-03 02:46:59 +0000
committergjb <gjb@FreeBSD.org>2015-03-03 02:46:59 +0000
commit8de40d01938fd77e1a70dc94ed2ec10c8eeb32bc (patch)
treed1068cbb88093aa017e74658cba34218e4658972 /release
parent1290baf2e3ffa7ac2d8f9639c7c3d8e32dc7e133 (diff)
downloadFreeBSD-src-8de40d01938fd77e1a70dc94ed2ec10c8eeb32bc.zip
FreeBSD-src-8de40d01938fd77e1a70dc94ed2ec10c8eeb32bc.tar.gz
MFC r279249, r279250, r279257:
r279249: Add 'cloudware-install' target to handle copying cloud disk images to a directory within DESTDIR. Add CLOUDINSTALL variable to automatically generate the actual list of install targets. While here, rename the cloud-specific names from 'vm-' to 'cw-' to avoid naming collisions. Add AZURE_DISK, GCE_DISK, and OPENSTACK_DISK output file variables. Add 'cloudware-install' to the 'install' target. r279250: Remove a stale comment. r279257: 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. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'release')
-rw-r--r--release/Makefile2
-rw-r--r--release/Makefile.vm41
-rwxr-xr-xrelease/tools/gce-package.sh47
3 files changed, 83 insertions, 7 deletions
diff --git a/release/Makefile b/release/Makefile
index f6afc1c..104b73e 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -319,7 +319,7 @@ real-release:
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
-install: release-install vm-install
+install: release-install vm-install cloudware-install
release-install:
.if defined(DESTDIR) && !empty(DESTDIR)
diff --git a/release/Makefile.vm b/release/Makefile.vm
index fe955d3..4d1486a 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -20,24 +20,30 @@ CLOUDWARE?= AZURE \
OPENSTACK
AZURE_FORMAT= vhdf
AZURE_DESC= Microsoft Azure platform image
+AZURE_DISK= ${OSRELEASE}.${AZURE_FORMAT}
GCE_FORMAT= raw
GCE_DESC= Google Compute Engine image
+GCE_DISK= disk.${GCE_FORMAT}
OPENSTACK_FORMAT=qcow2
OPENSTACK_DESC= OpenStack platform image
+OPENSTACK_DISK= ${OSRELEASE}.${OPENSTACK_FORMAT}
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
. for _CW in ${CLOUDWARE}
-CLOUDTARGETS+= vm-${_CW:tl}
-CLEANDIRS+= vm-${_CW:tl}
+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
. endif
-vm-${_CW:tl}:
+cw-${_CW:tl}:
mkdir -p ${.OBJDIR}/${.TARGET}
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
${.CURDIR}/scripts/mk-vmimage.sh \
@@ -45,6 +51,26 @@ vm-${_CW:tl}:
-i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW}_FORMAT} \
-S ${WORLDDIR} -o ${.OBJDIR}/${${_CW}IMAGE} -c ${${_CW}CONF}
touch ${.TARGET}
+
+cw${_CW:tl}-install:
+ mkdir -p ${DESTDIR}/${_CW:tl}
+ cp -p ${${_CW}IMAGE} \
+ ${DESTDIR}/${_CW:tl}/${${_CW}_DISK}
+ cd ${DESTDIR}/${_CW:tl} && sha256 ${${_CW}_DISK}* > \
+ ${DESTDIR}/${_CW:tl}/CHECKSUM.SHA256
+ 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
@@ -97,8 +123,6 @@ vm-install:
${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
. endfor
. if defined(WITH_COMPRESSED_VMIMAGES) && !empty(WITH_COMPRESSED_VMIMAGES)
-# This is very time consuming, so defer it after the images are moved to
-# the DESTDIR.
. for FORMAT in ${VMFORMATS}
# Don't keep the originals. There is a copy in ${.OBJDIR} if needed.
${XZCMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
@@ -119,3 +143,8 @@ cloudware-release:
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDTARGETS}
.endif
+
+cloudware-install:
+.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
+ ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDINSTALL}
+.endif
diff --git a/release/tools/gce-package.sh b/release/tools/gce-package.sh
new file mode 100755
index 0000000..5d8ec33
--- /dev/null
+++ b/release/tools/gce-package.sh
@@ -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 "$@"
OpenPOWER on IntegriCloud