svn commit: r272212 - user/gjb/thermite
Glen Barber
gjb at FreeBSD.org
Sat Sep 27 14:24:44 UTC 2014
Author: gjb
Date: Sat Sep 27 14:24:43 2014
New Revision: 272212
URL: http://svnweb.freebsd.org/changeset/base/272212
Log:
Check if mkimg(1) reports back a version which can be used
to determine which disk formats can be created. If the
version is not empty, use create_vmimage_mkimg() to create
the qcow2 format.
While here, use mkimg(1) instead of qemu-img to create the
raw disk format.
Many thanks to marcel@ for adding VHD and QCOW2 formats.
Sponsored by: The FreeBSD Foundation
Modified:
user/gjb/thermite/mk-vmimage.sh
Modified: user/gjb/thermite/mk-vmimage.sh
==============================================================================
--- user/gjb/thermite/mk-vmimage.sh Sat Sep 27 13:57:48 2014 (r272211)
+++ user/gjb/thermite/mk-vmimage.sh Sat Sep 27 14:24:43 2014 (r272212)
@@ -77,6 +77,8 @@ create_etc() {
}
create_vmimage_qemu() {
+ # mkimg(1) supports the formats being created.
+ [ ! -z "${no_qemu}" ] && return 0
diskformats="qcow2"
if [ ! -x /usr/local/bin/qemu-img ]; then
echo "qemu-img not found, skipping qcow2 format."
@@ -131,19 +133,25 @@ create_vmimage_qemu() {
xz ${CHROOTDIR}/vmimage/${VM_IMAGE_NAME}.${_f}
done
mdconfig -d -u ${mddev}
- mv ${CHROOTDIR}/vmimage/${VM_IMAGE_NAME}.rawdisk \
- ${CHROOTDIR}/vmimage/${VM_IMAGE_NAME}.raw
- xz ${CHROOTDIR}/vmimage/${VM_IMAGE_NAME}.raw
+ rm ${CHROOTDIR}/vmimage/${VM_IMAGE_NAME}.rawdisk
return 0
}
create_vmimage_mkimg() {
- diskformats="vmdk vhdf"
+ no_qemu=
+ diskformats="vmdk vhdf raw"
if [ ! -x /usr/bin/mkimg ]; then
return 0
fi
+ mkimg_version=$(/usr/bin/mkimg --version 2>/dev/null | awk '{print $2}')
+
+ if [ ! -z "${mkimg_version}" ]; then
+ diskformats="${diskformats} qcow2"
+ no_qemu=1
+ fi
+
if [ ! -d ${CHROOTDIR}/R/ftp ]; then
echo "Error: Cannot find the ftp/*.txz files."
exit 1
More information about the svn-src-user
mailing list