blob: 902442fdfdd894629cc5b521caa885e359304ebf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
#
# $FreeBSD$
#
#
# Makefile for building virtual machine and cloud provider disk images.
#
VMTARGETS= vm-image
VMFORMATS?= vhd vmdk qcow2 raw
VMSIZE?= 20G
VMBASE?= vm
VHD_DESC= Azure, VirtualPC, Hyper-V, Xen disk image
VMDK_DESC= VMWare, VirtualBox disk image
QCOW2_DESC= Qemu, KVM disk image
RAW_DESC= Unformatted raw disk image
CLOUDWARE?= AZURE \
EC2 \
GCE \
OPENSTACK \
VAGRANT-VIRTUALBOX \
VAGRANT-VMWARE
AZURE_FORMAT= vhdf
AZURE_DESC= Microsoft Azure platform image
AZURE_DISK= ${OSRELEASE}.${AZURE_FORMAT}
EC2_FORMAT= raw
EC2_DESC= Amazon EC2 image
EC2_DISK= ${OSRELEASE}.${EC2_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}
VAGRANT-VIRTUALBOX_FORMAT= vmdk
VAGRANT-VIRTUALBOX_DESC= Vagrant Image for VirtualBox
VAGRANT-VIRTUALBOX_DISK= ${OSRELEASE}.vbox.${VAGRANT_FORMAT}
VAGRANT-VMWARE_FORMAT= vmdk
VAGRANT-VMWARE_DESC= Vagrant Image for VMWare
VAGRANT-VMWARE_DISK= ${OSRELEASE}.vmware.${VAGRANT_FORMAT}
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
. for _CW in ${CLOUDWARE}
CLOUDTARGETS+= cw-${_CW:tl}
CLEANDIRS+= cw-${_CW:tl}
CLEANFILES+= ${_CW:tl}.img \
${_CW:tl}.${${_CW:tu}_FORMAT} \
${_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
cw-${_CW:tl}:
mkdir -p ${.OBJDIR}/${.TARGET}
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \
-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} && sha512 ${${_CW}_DISK}* > \
${DESTDIR}/${_CW:tl}/CHECKSUM.SHA512
cd ${DESTDIR}/${_CW:tl} && sha256 ${${_CW}_DISK}* > \
${DESTDIR}/${_CW:tl}/CHECKSUM.SHA256
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
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
CLEANDIRS+= ${VMTARGETS}
. for FORMAT in ${VMFORMATS}
CLEANFILES+= ${FORMAT}.img
CLEANFILES+= ${VMBASE}.${FORMAT}
. endfor
.endif
vm-base: vm-image
vm-image:
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
. for FORMAT in ${VMFORMATS}
mkdir -p ${.OBJDIR}/${.TARGET}
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \
-i ${.OBJDIR}/${FORMAT}.img -s ${VMSIZE} -f ${FORMAT} \
-S ${WORLDDIR} -o ${.OBJDIR}/${VMBASE}.${FORMAT}
. endfor
.endif
touch ${.TARGET}
vm-cloudware: ${CLOUDTARGETS}
list-vmtargets: list-cloudware
@${ECHO}
@${ECHO} "Supported virtual machine disk image formats:"
.for FORMAT in ${VMFORMATS:tu}
@${ECHO} " ${FORMAT:tl}: ${${FORMAT}_DESC}"
.endfor
list-cloudware:
.if !empty(CLOUDWARE)
@${ECHO}
@${ECHO} "Supported cloud hosting provider images:"
. for _CW in ${CLOUDWARE}
@${ECHO} " ${_CW:tu}: ${${_CW:tu}_DESC}"
. endfor
.endif
vm-install:
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
mkdir -p ${DESTDIR}/vmimages
. for FORMAT in ${VMFORMATS}
cp -p ${VMBASE}.${FORMAT} \
${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
. endfor
. if defined(WITH_COMPRESSED_VMIMAGES) && !empty(WITH_COMPRESSED_VMIMAGES)
. for FORMAT in ${VMFORMATS}
# Don't keep the originals. There is a copy in ${.OBJDIR} if needed.
${XZ_CMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
. endfor
. endif
cd ${DESTDIR}/vmimages && sha512 ${OSRELEASE}* > \
${DESTDIR}/vmimages/CHECKSUM.SHA512
cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \
${DESTDIR}/vmimages/CHECKSUM.SHA256
.endif
vm-release:
.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${VMTARGETS}
.endif
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
.include "${.CURDIR}/Makefile.ec2"
.include "${.CURDIR}/Makefile.azure"
.include "${.CURDIR}/Makefile.gce"
.include "${.CURDIR}/Makefile.vagrant"
|