Merge lp:~rcj/livecd-rootfs/trusty-proposed_ubuntu-cpc into lp:~ubuntu-core-dev/livecd-rootfs/trusty-proposed
- trusty-proposed_ubuntu-cpc
- Merge into trusty-proposed
Proposed by
Robert C Jennings
Status: | Merged |
---|---|
Approved by: | Mathieu Trudel-Lapierre |
Approved revision: | 943 |
Merged at revision: | 919 |
Proposed branch: | lp:~rcj/livecd-rootfs/trusty-proposed_ubuntu-cpc |
Merge into: | lp:~ubuntu-core-dev/livecd-rootfs/trusty-proposed |
Diff against target: |
2968 lines (+2588/-101) 34 files modified
debian/changelog (+142/-0) debian/copyright (+5/-1) live-build/auto/build (+43/-93) live-build/auto/config (+130/-7) live-build/ubuntu-cpc/functions (+259/-0) live-build/ubuntu-cpc/hooks/001-divert-sync.chroot_early (+11/-0) live-build/ubuntu-cpc/hooks/010-write-etc-ec2-version.chroot (+4/-0) live-build/ubuntu-cpc/hooks/020-pkg-configure.chroot (+28/-0) live-build/ubuntu-cpc/hooks/025-create-groups.chroot (+14/-0) live-build/ubuntu-cpc/hooks/030-root-tarball.binary (+32/-0) live-build/ubuntu-cpc/hooks/031-root-xz.binary (+13/-0) live-build/ubuntu-cpc/hooks/032-disk-image.binary (+124/-0) live-build/ubuntu-cpc/hooks/032-root-squashfs.binary (+19/-0) live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary (+141/-0) live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary (+79/-0) live-build/ubuntu-cpc/hooks/040-qcow2-image.binary (+23/-0) live-build/ubuntu-cpc/hooks/040-vmdk-image.binary (+22/-0) live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary (+105/-0) live-build/ubuntu-cpc/hooks/042-vagrant.binary (+221/-0) live-build/ubuntu-cpc/hooks/051-hwclock.chroot (+3/-0) live-build/ubuntu-cpc/hooks/052-ssh_authentication.chroot (+3/-0) live-build/ubuntu-cpc/hooks/060-ipv6.chroot (+18/-0) live-build/ubuntu-cpc/hooks/099-cleanup.chroot (+57/-0) live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot (+312/-0) live-build/ubuntu-cpc/hooks/999-extras.binary (+15/-0) live-build/ubuntu-cpc/hooks/999-undivert-sync.chroot (+5/-0) live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl (+180/-0) live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-vmdk.tmpl (+178/-0) live-build/ubuntu-cpc/hooks/ovf/ubuntu-ovf-v1-img.tmpl (+130/-0) live-build/ubuntu-cpc/hooks/raspi2/mkknlimg (+244/-0) live-build/ubuntu-cpc/includes.chroot/etc/hostname (+1/-0) live-build/ubuntu-cpc/includes.chroot/etc/hosts (+9/-0) live-build/ubuntu-cpc/includes.chroot/etc/network/interfaces (+15/-0) live-build/ubuntu-cpc/includes.chroot/etc/network/interfaces.d/eth0.cfg (+3/-0) |
To merge this branch: | bzr merge lp:~rcj/livecd-rootfs/trusty-proposed_ubuntu-cpc |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mathieu Trudel-Lapierre | Approve | ||
Steve Langasek | Pending | ||
Review via email: mp+324682@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Robert C Jennings (rcj) wrote : | # |
Revision history for this message
Robert C Jennings (rcj) wrote : | # |
I have attached the patch for live-build to bug #1693018.
Revision history for this message
Robert C Jennings (rcj) wrote : | # |
I'm missing an update to debian/control to change the version dependency for live-build. When the changes for live-build attached to the bug are uploaded and the version is known then this should be updated to require that version or newer.
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote : | # |
For the most part, aside from sources.list updates this is straightforward addition of the ubuntu-cpc project and the related corner-cases. Please make sure to add an entry about the 'virtual' case for kernels.
review:
Needs Fixing
- 942. By Robert C Jennings
-
Remove old bug references from backport
- 943. By Robert C Jennings
-
Add changelog entry for mapping of virual flavor to generic kernel
Revision history for this message
Robert C Jennings (rcj) wrote : | # |
Added a changelog entry for the virtual case for kernels
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote : | # |
Looks good, thanks!
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2017-05-12 18:41:39 +0000 |
3 | +++ debian/changelog 2017-06-01 19:33:22 +0000 |
4 | @@ -1,3 +1,145 @@ |
5 | +livecd-rootfs (2.209) trusty; urgency=medium |
6 | + |
7 | + * Add ubuntu-cpc project (LP: #1693018) |
8 | + |
9 | + [ Daniel Watkins ] |
10 | + * Move building of all architecture-specific CPC artifacts into Launchpad |
11 | + - Fixup virtual FLAVOUR kernel name |
12 | + |
13 | + [ Oliver Grawert ] |
14 | + * added additional CPC build targets: |
15 | + - added manifest generation for squashfs and root.tar.gz |
16 | + - added VMDK generation |
17 | + - added OVA generation from VMDK's |
18 | + - added generic Vagrant image generation |
19 | + |
20 | + [ Ben Howard ] |
21 | + * Fix typo in ubuntu-cpc preventing non-intel builds. |
22 | + * add devpts-live to hook builds |
23 | + * add logic to settle the disks after UEFI builds |
24 | + * extended hooks/functions to support creation of derivative images |
25 | + * including mounting images. |
26 | + * added the ability to create qcow2 images in hooks/functions |
27 | + * simplified loop clean-up in hooks/functions |
28 | + * removed assumption that disk1.img would be built |
29 | + * switched qcow2 generation to use hooks/functions function |
30 | + |
31 | + [ Daniel Watkins ] |
32 | + * Produce OVA files for i386 cloud builds. |
33 | + |
34 | + [ Ben Howard ] |
35 | + * Remove unneeded packages from the root.tar.{gz,xz} cloud image targets |
36 | + |
37 | + [ Daniel Watkins ] |
38 | + * Install grub in ppc64el cloud images so they are bootable |
39 | + |
40 | + [ Daniel Watkins ] |
41 | + * Set timeout options so ppc64el cloud images don't display a grub boot |
42 | + menu (matching the behaviour of other cloud images). |
43 | + * Specify a regex to run-parts so that cloud image extra scripts are found |
44 | + and executed. |
45 | + |
46 | + [ Steve Langasek ] |
47 | + * Refactor/reorder ubuntu-cpc support for consistency with other flavors, |
48 | + so that subarch overrides can be applied correctly. |
49 | + |
50 | + [ Ben Howard ] |
51 | + * fixed loop setup due to change of kpartx output |
52 | + * only use grub-install logic for Intel architectures |
53 | + |
54 | + [ Steve Langasek ] |
55 | + * Refactor some non-idiomatic architecture handling in |
56 | + live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot that also misidentifies |
57 | + the architecture name for armhf. |
58 | + |
59 | + [ Steve Langasek ] |
60 | + * Add hooks to ubuntu-cpc to divert /bin/sync in the chroot and undivert it |
61 | + at the end. This is a general-purpose change that should be applied to |
62 | + all flavors and archs, but at the moment it's only needed on armhf+raspi2 |
63 | + to work around the raspberrypi2-firmware postinst calling sync, which is |
64 | + actually warranted in the normal case. |
65 | + * If a subarch is specified for a cloud image build, don't build rootfs |
66 | + artifacts; these should come from the 'generic' build. |
67 | + * Fix architecture handling in hooks. We know we're always being invoked |
68 | + from a launchpad-buildd-like setup, which passes ARCH and SUBARCH in the |
69 | + environment, because auto/config and auto/build both rely on this. So |
70 | + don't scatter dpkg --print-architecture calls throughout, especially |
71 | + when many of these are not cross-build-aware. |
72 | + * Refactor ubuntu-cpc hooks to allow us to handle images where the root |
73 | + partition should not be partition 1. |
74 | + |
75 | + [ Ben Howard ] |
76 | + * ubuntu-cpc: fix hooks/032-disk-image.binary call to |
77 | + create_empty_partition, which requires five args due to "-u" |
78 | + * ubuntu-cpc: in hooks/030-root-tarball.binary create /lib/modules to fix |
79 | + |
80 | + [ Steve Langasek ] |
81 | + * Refactor ubuntu-cpc hooks to always produce a 'plain' rootfs via |
82 | + live-build and reuse this for the tarball, instead of lb_binary_rootfs |
83 | + creating some artifact that we ignore / throw away. |
84 | + * Initial support for raspi2 subarch. |
85 | + * Import live-build/ubuntu-cpc/hooks/raspi2/mkknlimg from |
86 | + https://github.com/raspberrypi/linux/blob/rpi-4.1.y/scripts/mkknlimg |
87 | + and use it to install a bootable uboot.bin. |
88 | + |
89 | + [ Adam Conrad ] |
90 | + * live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot: Add fake_cloud_init |
91 | + function to create a nocloud data source for cloud images that aren't |
92 | + meant to be used on real clouds and use it by default on armhf+raspi2 |
93 | + |
94 | + [ Ben Howard ] |
95 | + * live-build/ubuntu-cpc/hooks/042-vagrant.binary: add serial device for |
96 | + Vagrant images |
97 | + |
98 | + [ Daniel Watkins ] |
99 | + * Refactor ubuntu-cpc hooks to hard-code producing an 'ext4' rootfs, which |
100 | + is used outside of the livecd-rootfs build process (specifically for EC2 |
101 | + publication). |
102 | + |
103 | + [ Ben Howard ] |
104 | + * live-build/ubuntu-cpc/hooks/042-vagrant.binary: scope serial device for |
105 | + Virtualbox only. |
106 | + |
107 | + [ Daniel Watkins ] |
108 | + * Enable building of powerpc cloud images. |
109 | + |
110 | + [ Louis Zuckerman ] |
111 | + * Fixes for vagrant box builder in ubuntu-cpc |
112 | + - Install virtualbox-guest-utils |
113 | + - Don't disable default synced folder |
114 | + - Don't set vm name |
115 | + - Add cloud-init config to manage /etc/hosts |
116 | + |
117 | + [ Steve Langasek ] |
118 | + * live-build/ubuntu-cpc/hooks/042-vagrant.binary: fix unmount handling |
119 | + so that the teardown is done properly /before/ we try to make an |
120 | + image from our filesystem, since otherwise /etc/resolv.conf is broken. |
121 | + |
122 | + [ Daniel Watkins ] |
123 | + * Don't overwrite the default sources.list in cloud images. |
124 | + * Replace sources.list generated using COMPONENTS with the sources.list from |
125 | + an Ubuntu Server installation (i.e. with all components enabled, and all |
126 | + deb-src lines commented). |
127 | + |
128 | + [ Chris Glass ] |
129 | + * Fix the manifest generation in OVA files so that ovf files don't have |
130 | + double extensions. |
131 | + * Fix the OVF's metadata to include Ubuntu specific identifiers and |
132 | + descriptions instead of the generic Linux ones. |
133 | + |
134 | + [ Daniel Watkins ] |
135 | + * Add replace_grub_root_with_label function thereby consolidating multiple |
136 | + uses of the same calls to sed. |
137 | + |
138 | + [ Robert C Jennings ] |
139 | + * ubuntu-cpc: Remove redundant copy of grub files. |
140 | + |
141 | + [ Daniel Watkins ] |
142 | + * Add `apt-get update` to ubuntu-cpc ppc64el builds so they use the new |
143 | + sources. |
144 | + |
145 | + -- Robert C Jennings <robert.jennings@canonical.com> Mon, 08 May 2017 17:07:02 -0500 |
146 | + |
147 | livecd-rootfs (2.208.14) UNRELEASED; urgency=medium |
148 | |
149 | [ Balint Reczey ] |
150 | |
151 | === modified file 'debian/copyright' |
152 | --- debian/copyright 2013-07-24 10:44:13 +0000 |
153 | +++ debian/copyright 2017-06-01 19:33:22 +0000 |
154 | @@ -1,4 +1,4 @@ |
155 | -live-build/* is copyright (c) 2004-2013 by Canonical Ltd. |
156 | +live-build/* is copyright (c) 2004-2016 by Canonical Ltd. |
157 | |
158 | These programs are free software; you can redistribute and/or modify |
159 | them under the terms of the GNU General Public License as published by |
160 | @@ -16,3 +16,7 @@ |
161 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
162 | Boston, MA 02110-1301 USA. |
163 | |
164 | +Files: live-build/ubuntu-cpc/hooks/raspi2/mkknlimg |
165 | +Copyright: 2009,2010 Dick Streefland <dick@streefland.net> |
166 | + 2014,2015 Raspberry Pi (Trading) Limited <info@raspberrypi.org> |
167 | +License: GPL-2+ |
168 | |
169 | === modified file 'live-build/auto/build' |
170 | --- live-build/auto/build 2015-02-02 13:21:03 +0000 |
171 | +++ live-build/auto/build 2017-06-01 19:33:22 +0000 |
172 | @@ -55,116 +55,56 @@ |
173 | # preinstalled being slightly different in what it doesn't ask) from |
174 | # debian-installer's apt-setup: |
175 | |
176 | -codename=$LB_DISTRIBUTION |
177 | -file="chroot/etc/apt/sources.list" |
178 | -dists="main" |
179 | -alldists="main" |
180 | -if echo "$LB_PARENT_ARCHIVE_AREAS" | grep -q restricted; then |
181 | - dists="$dists restricted" |
182 | - alldists="$alldists restricted" |
183 | -fi |
184 | -if echo "$LB_PARENT_ARCHIVE_AREAS" | grep -q universe; then |
185 | - UNIVERSE=true |
186 | -else |
187 | - UNIVERSE=false |
188 | -fi |
189 | -if echo "$LB_PARENT_ARCHIVE_AREAS" | grep -q multiverse; then |
190 | - MULTIVERSE=true |
191 | -else |
192 | - MULTIVERSE=false |
193 | -fi |
194 | - |
195 | -cat > $file <<EOF |
196 | +cat > chroot/etc/apt/sources.list << EOF |
197 | # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to |
198 | # newer versions of the distribution. |
199 | - |
200 | -deb $LB_PARENT_MIRROR_BINARY $codename $dists |
201 | -deb-src $LB_PARENT_MIRROR_BINARY $codename $dists |
202 | +deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION main restricted |
203 | +# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION main restricted |
204 | |
205 | ## Major bug fix updates produced after the final release of the |
206 | ## distribution. |
207 | -deb $LB_PARENT_MIRROR_BINARY $codename-updates $dists |
208 | -deb-src $LB_PARENT_MIRROR_BINARY $codename-updates $dists |
209 | -EOF |
210 | +deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates main restricted |
211 | +# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates main restricted |
212 | |
213 | -# Even if universe isn't enabled, we write example lines for it. |
214 | -echo >> $file |
215 | -if [ "$UNIVERSE" = true ]; then |
216 | - alldists="$alldists universe" |
217 | - COMMENT= |
218 | -else |
219 | - cat >> $file <<EOF |
220 | -## Uncomment the following two lines to add software from the 'universe' |
221 | -## repository. |
222 | -EOF |
223 | - COMMENT='# ' |
224 | -fi |
225 | -cat >> $file <<EOF |
226 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu |
227 | ## team. Also, please note that software in universe WILL NOT receive any |
228 | ## review or updates from the Ubuntu security team. |
229 | -${COMMENT}deb $LB_PARENT_MIRROR_BINARY $codename universe |
230 | -${COMMENT}deb-src $LB_PARENT_MIRROR_BINARY $codename universe |
231 | -${COMMENT}deb $LB_PARENT_MIRROR_BINARY $codename-updates universe |
232 | -${COMMENT}deb-src $LB_PARENT_MIRROR_BINARY $codename-updates universe |
233 | -EOF |
234 | - |
235 | -# Multiverse is different, don't write anything unless enabled. |
236 | -if [ "$MULTIVERSE" = true ]; then |
237 | - alldists="$alldists multiverse" |
238 | - cat >> $file <<EOF |
239 | - |
240 | -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu |
241 | -## team, and may not be under a free licence. Please satisfy yourself as to |
242 | -## your rights to use the software. Also, please note that software in |
243 | +deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION universe |
244 | +# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION universe |
245 | +deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates universe |
246 | +# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates universe |
247 | + |
248 | +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu |
249 | +## team, and may not be under a free licence. Please satisfy yourself as to |
250 | +## your rights to use the software. Also, please note that software in |
251 | ## multiverse WILL NOT receive any review or updates from the Ubuntu |
252 | ## security team. |
253 | -deb $LB_PARENT_MIRROR_BINARY $codename multiverse |
254 | -deb-src $LB_PARENT_MIRROR_BINARY $codename multiverse |
255 | -deb $LB_PARENT_MIRROR_BINARY $codename-updates multiverse |
256 | -deb-src $LB_PARENT_MIRROR_BINARY $codename-updates multiverse |
257 | -EOF |
258 | -fi |
259 | - |
260 | -cat >> $file <<EOF |
261 | +deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION multiverse |
262 | +# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION multiverse |
263 | +deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates multiverse |
264 | +# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates multiverse |
265 | |
266 | ## N.B. software from this repository may not have been tested as |
267 | ## extensively as that contained in the main release, although it includes |
268 | ## newer versions of some applications which may provide useful features. |
269 | ## Also, please note that software in backports WILL NOT receive any review |
270 | ## or updates from the Ubuntu security team. |
271 | -# deb $LB_PARENT_MIRROR_BINARY $codename-backports $alldists |
272 | -# deb-src $LB_PARENT_MIRROR_BINARY $codename-backports $alldists |
273 | -EOF |
274 | - |
275 | -cat >> $file <<EOF |
276 | - |
277 | -deb $LB_PARENT_MIRROR_BINARY $codename-security $dists |
278 | -deb-src $LB_PARENT_MIRROR_BINARY $codename-security $dists |
279 | -EOF |
280 | - |
281 | -# Security sources for Ubuntu universe; not used much, but e.g. unsupported |
282 | -# binary packages from a supported source package will end up here. |
283 | -if [ "$UNIVERSE" = true ]; then |
284 | - COMMENT= |
285 | -else |
286 | - COMMENT='# ' |
287 | -fi |
288 | -cat >> $file <<EOF |
289 | -${COMMENT}deb $LB_PARENT_MIRROR_BINARY $codename-security universe |
290 | -${COMMENT}deb-src $LB_PARENT_MIRROR_BINARY $codename-security universe |
291 | -EOF |
292 | - |
293 | -# Security sources for Ubuntu multiverse, with the same caveats as for |
294 | -# universe. |
295 | -if [ "$MULTIVERSE" = true ]; then |
296 | - COMMENT= |
297 | -else |
298 | - COMMENT='# ' |
299 | -fi |
300 | -cat >> $file <<EOF |
301 | -${COMMENT}deb $LB_PARENT_MIRROR_BINARY $codename-security multiverse |
302 | -${COMMENT}deb-src $LB_PARENT_MIRROR_BINARY $codename-security multiverse |
303 | +deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-backports main restricted universe multiverse |
304 | +# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-backports main restricted universe multiverse |
305 | + |
306 | +## Uncomment the following two lines to add software from Canonical's |
307 | +## 'partner' repository. |
308 | +## This software is not part of Ubuntu, but is offered by Canonical and the |
309 | +## respective vendors as a service to Ubuntu users. |
310 | +# deb http://archive.canonical.com/ubuntu $LB_DISTRIBUTION partner |
311 | +# deb-src http://archive.canonical.com/ubuntu $LB_DISTRIBUTION partner |
312 | + |
313 | +deb http://security.ubuntu.com/ubuntu $LB_DISTRIBUTION-security main restricted |
314 | +# deb-src http://security.ubuntu.com/ubuntu $LB_DISTRIBUTION-security main restricted |
315 | +deb http://security.ubuntu.com/ubuntu $LB_DISTRIBUTION-security universe |
316 | +# deb-src http://security.ubuntu.com/ubuntu $LB_DISTRIBUTION-security universe |
317 | +deb http://security.ubuntu.com/ubuntu $LB_DISTRIBUTION-security multiverse |
318 | +# deb-src http://security.ubuntu.com/ubuntu $LB_DISTRIBUTION-security multiverse |
319 | EOF |
320 | |
321 | fi |
322 | @@ -241,6 +181,12 @@ |
323 | mkdir -p chroot/var/log/installer |
324 | Chroot chroot "ln -s /etc/media-info /var/log/installer/media-info" |
325 | fi |
326 | + if [ "$PROJECT" = "ubuntu-cpc" ]; then |
327 | + cat > chroot/etc/cloud/build.info << EOF |
328 | +build_name: server |
329 | +serial: $BUILDSTAMP |
330 | +EOF |
331 | + fi |
332 | |
333 | echo "===== Checking size of /usr/share/doc =====" |
334 | echo BEGIN docdirs |
335 | @@ -329,6 +275,10 @@ |
336 | continue |
337 | fi |
338 | FLAVOUR=${FLAVOUR%%-lts-*} |
339 | + if [ "$FLAVOUR" = "virtual" ]; then |
340 | + # The virtual kernel is named generic in /boot |
341 | + FLAVOUR="generic" |
342 | + fi |
343 | KVERS="$( (cd "binary/$INITFS"; ls vmlinu?-* 2>/dev/null || true) | (fgrep -v .efi || true) | sed -n "s/^vmlinu.-\\([^-]*-[^-]*-$FLAVOUR\\)$/\\1/p" )" |
344 | if [ -z "$KVERS" ]; then |
345 | if [ -e "binary/$INITFS/vmlinuz" ]; then |
346 | |
347 | === modified file 'live-build/auto/config' |
348 | --- live-build/auto/config 2016-07-25 20:31:30 +0000 |
349 | +++ live-build/auto/config 2017-06-01 19:33:22 +0000 |
350 | @@ -111,6 +111,12 @@ |
351 | BINARY_HOOKS="${BINARY_HOOKS:+$BINARY_HOOKS }$1" |
352 | } |
353 | |
354 | +case $PROJECT in |
355 | + ubuntu-cpc) |
356 | + IMAGEFORMAT=ext4 |
357 | + ;; |
358 | +esac |
359 | + |
360 | case $IMAGEFORMAT in |
361 | ext2|ext3|ext4) |
362 | OPTS="${OPTS:+$OPTS }--initramfs none --chroot-filesystem $IMAGEFORMAT" |
363 | @@ -121,9 +127,15 @@ |
364 | COMPONENTS='main restricted universe multiverse' |
365 | ;; |
366 | *) |
367 | - add_package live jasper |
368 | - OPTS="${OPTS:+$OPTS }--swap-file-path SWAP.swap" |
369 | - OPTS="${OPTS:+$OPTS }--swap-file-size 512" |
370 | + case $PROJECT in |
371 | + ubuntu-cpc) |
372 | + ;; |
373 | + *) |
374 | + add_package live jasper |
375 | + OPTS="${OPTS:+$OPTS }--swap-file-path SWAP.swap" |
376 | + OPTS="${OPTS:+$OPTS }--swap-file-size 512" |
377 | + ;; |
378 | + esac |
379 | ;; |
380 | esac |
381 | ;; |
382 | @@ -164,7 +176,7 @@ |
383 | ubuntu-server) |
384 | add_package live oem-config-debconf ubiquity-frontend-debconf |
385 | ;; |
386 | - ubuntu-core|ubuntu-base|base|ubuntu-touch) |
387 | + ubuntu-core|ubuntu-base|base|ubuntu-touch|ubuntu-cpc) |
388 | ;; |
389 | *) |
390 | add_package live oem-config-gtk ubiquity-frontend-gtk |
391 | @@ -381,6 +393,38 @@ |
392 | OPTS="${OPTS:+$OPTS }--zsync false" |
393 | ;; |
394 | |
395 | + ubuntu-cpc) |
396 | + add_task install minimal standard cloud-image |
397 | + add_package install ubuntu-minimal |
398 | + |
399 | + BINARY_REMOVE_LINUX=false |
400 | + OPTS="${OPTS:+$OPTS }--initramfs=none" |
401 | + KERNEL_FLAVOURS=virtual |
402 | + case $ARCH in |
403 | + armhf) |
404 | + KERNEL_FLAVOURS=generic-lpae |
405 | + add_package install flash-kernel |
406 | + add_task install server |
407 | + ;; |
408 | + arm64) |
409 | + KERNEL_FLAVOURS=generic |
410 | + add_package install flash-kernel |
411 | + add_task install server |
412 | + ;; |
413 | + ppc64el) |
414 | + add_task install server |
415 | + ;; |
416 | + powerpc) |
417 | + KERNEL_FLAVOURS=powerpc64-smp |
418 | + add_task install server |
419 | + ;; |
420 | + esac |
421 | + OPTS="${OPTS:+$OPTS }--system=normal" |
422 | + OPTS="${OPTS:+$OPTS }--hdd-label=cloudimg-rootfs" |
423 | + OPTS="${OPTS:+$OPTS }--ext-resize-blocks=536870912 --ext-block-size=4096" |
424 | + OPTS="${OPTS:+$OPTS }--ext-fudge-factor=15" |
425 | + ;; |
426 | + |
427 | *) |
428 | echo "unknown project $PROJECT" >&2 |
429 | exit 2 |
430 | @@ -446,6 +490,11 @@ |
431 | echo "linux-firmware-nexus7 shared/nexus7_notice_accepted boolean true" >config/preseed/linux-firmware-nexus7.preseed.chroot |
432 | echo "d-i passwd/auto-login boolean true" >config/preseed/autologin.preseed.chroot |
433 | ;; |
434 | + raspi2) |
435 | + COMPONENTS='main restricted universe' |
436 | + add_package install raspberrypi2-firmware u-boot-rpi flash-kernel u-boot-tools |
437 | + BINARY_REMOVE_LINUX=false |
438 | + ;; |
439 | esac |
440 | ;; |
441 | esac |
442 | @@ -466,7 +515,7 @@ |
443 | add_chroot_hook remove-udev-persistent-rules |
444 | |
445 | case $PROJECT in |
446 | - ubuntu-server) |
447 | + ubuntu-server|ubuntu-cpc) |
448 | ;; |
449 | |
450 | *) |
451 | @@ -502,6 +551,80 @@ |
452 | echo "LB_BINARY_HOOKS=\"$BINARY_HOOKS\"" >> config/binary |
453 | echo "BUILDSTAMP=\"$NOW\"" >> config/binary |
454 | |
455 | +case $ARCH+$SUBARCH in |
456 | + armhf+raspi2) |
457 | + cat > config/hooks/01-firmware-directory.chroot_early <<EOF |
458 | +#!/bin/sh -ex |
459 | +mkdir -p /boot/firmware |
460 | +EOF |
461 | + cat > config/hooks/999-raspi2-fixes.chroot <<EOF |
462 | +#!/bin/sh -ex |
463 | +cat >> /etc/fstab << EOM |
464 | +LABEL=system-boot /boot/firmware vfat defaults 0 1 |
465 | +EOM |
466 | + |
467 | +cat > /boot/firmware/cmdline.txt << EOM |
468 | +dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait |
469 | +EOM |
470 | + |
471 | +cat > /boot/firmware/config.txt << EOM |
472 | +# For more options and information see |
473 | +# http://www.raspberrypi.org/documentation/configuration/config-txt.md |
474 | +# Some settings may impact device functionality. See link above for details |
475 | + |
476 | +kernel=uboot.bin |
477 | + |
478 | +# enable i2c |
479 | +dtparam=i2c_arm=on |
480 | +dtparam=spi=on |
481 | + |
482 | +# uncomment if you get no picture on HDMI for a default "safe" mode |
483 | +#hdmi_safe=1 |
484 | + |
485 | +# uncomment this if your display has a black border of unused pixels visible |
486 | +# and your display can output without overscan |
487 | +#disable_overscan=1 |
488 | + |
489 | +# uncomment the following to adjust overscan. Use positive numbers if console |
490 | +# goes off screen, and negative if there is too much border |
491 | +#overscan_left=16 |
492 | +#overscan_right=16 |
493 | +#overscan_top=16 |
494 | +#overscan_bottom=16 |
495 | + |
496 | +# uncomment to force a console size. By default it will be display's size minus |
497 | +# overscan. |
498 | +#framebuffer_width=1280 |
499 | +#framebuffer_height=720 |
500 | + |
501 | +# uncomment if hdmi display is not detected and composite is being output |
502 | +#hdmi_force_hotplug=1 |
503 | + |
504 | +# uncomment to force a specific HDMI mode (this will force VGA) |
505 | +#hdmi_group=1 |
506 | +#hdmi_mode=1 |
507 | + |
508 | +# uncomment to force a HDMI mode rather than DVI. This can make audio work in |
509 | +# DMT (computer monitor) modes |
510 | +#hdmi_drive=2 |
511 | + |
512 | +# uncomment to increase signal to HDMI, if you have interference, blanking, or |
513 | +# no display |
514 | +#config_hdmi_boost=4 |
515 | + |
516 | +# uncomment for composite PAL |
517 | +#sdtv_mode=2 |
518 | + |
519 | +#uncomment to overclock the arm. 700 MHz is the default. |
520 | +#arm_freq=800 |
521 | + |
522 | +EOM |
523 | +EOF |
524 | + ;; |
525 | + *) |
526 | + ;; |
527 | +esac |
528 | + |
529 | case $PROJECT in |
530 | ubuntu-server) |
531 | cat > config/hooks/100-remove-fstab.chroot <<EOF |
532 | @@ -556,8 +679,8 @@ |
533 | fi |
534 | ;; |
535 | |
536 | - ubuntu-touch) |
537 | - cp -af /usr/share/livecd-rootfs/live-build/ubuntu-touch/* \ |
538 | + ubuntu-touch|ubuntu-cpc) |
539 | + cp -af /usr/share/livecd-rootfs/live-build/${PROJECT}/* \ |
540 | config/ |
541 | ;; |
542 | esac |
543 | |
544 | === added directory 'live-build/ubuntu-cpc' |
545 | === added file 'live-build/ubuntu-cpc/functions' |
546 | --- live-build/ubuntu-cpc/functions 1970-01-01 00:00:00 +0000 |
547 | +++ live-build/ubuntu-cpc/functions 2017-06-01 19:33:22 +0000 |
548 | @@ -0,0 +1,259 @@ |
549 | +# vi: ts=4 expandtab syntax=sh |
550 | + |
551 | +CLOUD_IMG_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" |
552 | +IMAGE_SIZE=$((2252*1024**2)) # 2.2G (the current size we ship) |
553 | + |
554 | +rootfs_dev_mapper= |
555 | +loop_device= |
556 | +loop_raw= |
557 | +backing_img= |
558 | + |
559 | +apt-get -qqy install dosfstools gdisk |
560 | + |
561 | +clean_loops() { |
562 | + |
563 | + if [ -n "${backing_img}" ]; then |
564 | + kpartx -v -d "${backing_img}" |
565 | + unset backing_img |
566 | + fi |
567 | + |
568 | + if [ -z "${rootfs_dev_mapper}" ]; then |
569 | + return 0 |
570 | + fi |
571 | + |
572 | + unset loop_device |
573 | + unset loop_raw |
574 | + unset rootfs_dev_mapper |
575 | +} |
576 | + |
577 | +create_empty_disk_image() { |
578 | + # Prepare an empty disk image |
579 | + dd if=/dev/zero of="$1" bs=1 count=0 seek="${IMAGE_SIZE}" |
580 | +} |
581 | + |
582 | +make_ext4_partition() { |
583 | + device="$1" |
584 | + |
585 | + mkfs.ext4 -F -b 4096 -i 8192 -m 0 -L cloudimg-rootfs -E resize=536870912 "$device" |
586 | +} |
587 | + |
588 | +mount_image() { |
589 | + apt-get install -qqy kpartx |
590 | + trap clean_loops EXIT |
591 | + backing_img="$1" |
592 | + local rootpart="$2" |
593 | + kpartx_mapping="$(kpartx -s -v -a ${backing_img})" |
594 | + |
595 | + # Find the loop device |
596 | + loop_p1="$(echo -e ${kpartx_mapping} | head -n1 | awk '{print$3}')" |
597 | + loop_device="/dev/loop$(echo ${loop_p1} | cut -b5)" |
598 | + if [ ! -b ${loop_device} ]; then |
599 | + echo "unable to find loop device for ${backing_img}" |
600 | + exit 1 |
601 | + fi |
602 | + |
603 | + # Find the rootfs location |
604 | + rootfs_dev_mapper="/dev/mapper/${loop_p1%%[0-9]}${rootpart}" |
605 | + if [ ! -b "${rootfs_dev_mapper}" ]; then |
606 | + echo "${rootfs_dev_mapper} is not a block device"; |
607 | + exit 1 |
608 | + fi |
609 | + |
610 | + # Add some information to the debug logs |
611 | + echo "Mounted disk image ${backing_img} to ${rootfs_dev_mapper}" |
612 | + blkid ${rootfs_dev_mapper} || true |
613 | + |
614 | + return 0 |
615 | +} |
616 | + |
617 | +setup_mountpoint() { |
618 | + local mountpoint="$1" |
619 | + |
620 | + mount --bind /dev "$mountpoint/dev" |
621 | + mount devpts-live -t proc "$mountpoint/dev/pts" |
622 | + mount proc-live -t proc "$mountpoint/proc" |
623 | + mount sysfs-live -t sysfs "$mountpoint/sys" |
624 | + mount -t tmpfs none "$mountpoint/tmp" |
625 | + mv "$mountpoint/etc/resolv.conf" resolv.conf.tmp |
626 | + cp /etc/resolv.conf "$mountpoint/etc/resolv.conf" |
627 | + |
628 | +} |
629 | + |
630 | +mount_partition() { |
631 | + partition="$1" |
632 | + mountpoint="$2" |
633 | + |
634 | + mount "$partition" "$mountpoint" |
635 | + setup_mountpoint "$mountpoint" |
636 | +} |
637 | + |
638 | + |
639 | +mount_disk_image() { |
640 | + local disk_image=${1} |
641 | + local mountpoint=${2} |
642 | + mount_image ${disk_image} 1 |
643 | + mount_partition "${rootfs_dev_mapper}" $mountpoint |
644 | + |
645 | + local uefi_dev="/dev/mapper${loop_device///dev/}p15" |
646 | + if [ -b ${uefi_dev} -a -e $mountpoint/boot/efi ]; then |
647 | + mount "${uefi_dev}" $mountpoint/boot/efi |
648 | + fi |
649 | + |
650 | + # This is needed to allow for certain operations |
651 | + # such as updating grub and installing software |
652 | + cat > $mountpoint/usr/sbin/policy-rc.d << EOF |
653 | +#!/bin/sh |
654 | +# ${CLOUD_IMG_STR} |
655 | +echo "All runlevel operations denied by policy" >&2 |
656 | +exit 101 |
657 | +EOF |
658 | + chmod 0755 $mountpoint/usr/sbin/policy-rc.d |
659 | + |
660 | +} |
661 | + |
662 | +umount_settle() { |
663 | + # Unmount device, and let it settle |
664 | + umount $1 |
665 | + udevadm settle |
666 | + sleep 3 |
667 | +} |
668 | + |
669 | +umount_partition() { |
670 | + local mountpoint=${1} |
671 | + mv resolv.conf.tmp "$mountpoint/etc/resolv.conf" |
672 | + for submnt in proc sys dev/pts dev tmp; |
673 | + do |
674 | + umount_settle $mountpoint/$submnt |
675 | + done |
676 | + umount_settle $mountpoint |
677 | + |
678 | + if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then |
679 | + # buildd's don't have /etc/mtab symlinked |
680 | + # /etc/mtab is needed in order zerofree space for ext4 filesystems |
681 | + [ -e /etc/mtab ] || ln -s /proc/mounts /etc/mtab |
682 | + |
683 | + # both of these are likely overkill, but it does result in slightly |
684 | + # smaller ext4 filesystem |
685 | + apt-get -qqy install zerofree |
686 | + e2fsck -y -E discard ${rootfs_dev_mapper} |
687 | + zerofree ${rootfs_dev_mapper} |
688 | + fi |
689 | +} |
690 | + |
691 | +umount_disk_image() { |
692 | + mountpoint="$1" |
693 | + |
694 | + local uefi_dev="/dev/mapper${loop_device///dev/}p15" |
695 | + if [ -e "$mountpoint/boot/efi" -a -b "$uefi_dev" ]; then |
696 | + umount --detach-loop "$mountpoint/boot/efi" |
697 | + fi |
698 | + |
699 | + if [ -e $mountpoint/usr/sbin/policy-rc.d ]; then |
700 | + rm $mountpoint/usr/sbin/policy-rc.d |
701 | + fi |
702 | + umount_partition $mountpoint |
703 | + clean_loops |
704 | +} |
705 | + |
706 | +modify_vmdk_header() { |
707 | + # Modify the VMDK headers so that both VirtualBox _and_ VMware can |
708 | + # read the vmdk and import them. The vodoo here is _not_ documented |
709 | + # anywhere....so this will have to do. This is undocumented vodoo |
710 | + # that has been learned by the Cloud Image team. |
711 | + |
712 | + vmdk_name="${1}" |
713 | + descriptor=$(mktemp) |
714 | + newdescriptor=$(mktemp) |
715 | + |
716 | + # Extract the vmdk header for manipulation |
717 | + dd if="${vmdk_name}" of="${descriptor}" bs=1 skip=512 count=1024 |
718 | + |
719 | + # The sed lines below is where the magic is. Specifically: |
720 | + # ddb.toolsVersion: sets the open-vm-tools so that VMware shows |
721 | + # the tooling as current |
722 | + # ddb.virtualHWVersion: set the version to 7, which covers most |
723 | + # current versions of VMware |
724 | + # createType: make sure its set to stream Optimized |
725 | + # remove the vmdk-stream-converter comment and replace with |
726 | + # # Disk DescriptorFile. This is needed for Virtualbox |
727 | + # remove the comments from vmdk-stream-converter which causes |
728 | + # VirtualBox and others to fail VMDK validation |
729 | + |
730 | + sed -e 's|# Description file.*|# Disk DescriptorFile|' \ |
731 | + -e '/# Believe this is random*/d' \ |
732 | + -e '/# Indicates no parent/d' \ |
733 | + -e '/# The Disk Data Base/d' \ |
734 | + -e 's|ddb.comment.*|ddb.toolsVersion = "2147483647"|' \ |
735 | + "${descriptor}" > "${newdescriptor}" |
736 | + |
737 | + # The header is cannot be bigger than 1024 |
738 | + expr $(stat --format=%s ${newdescriptor}) \< 1024 > /dev/null 2>&1 || { |
739 | + echo "descriptor is too large, VMDK will be invalid!"; exit 1; } |
740 | + |
741 | + # Overwrite the vmdk header with our new, modified one |
742 | + dd conv=notrunc,nocreat \ |
743 | + if="${newdescriptor}" of="${vmdk_name}" \ |
744 | + bs=1 seek=512 count=1024 |
745 | + |
746 | + rm ${descriptor} ${newdescriptor} |
747 | +} |
748 | + |
749 | +create_vmdk() { |
750 | + # There is no real good way to create a _compressed_ VMDK using open source |
751 | + # tooling that works across multiple VMDK-capable platforms. This functions |
752 | + # uses vmdk-stream-converter and then calls modify_vmdk_header to produce a |
753 | + # compatible VMDK. |
754 | + |
755 | + src="$1" |
756 | + destination="$2" |
757 | + size="${3:-10240}" |
758 | + |
759 | + apt-get install -qqy qemu-utils vmdk-stream-converter |
760 | + streamconverter="/usr/share/pyshared/VMDKstream.py" |
761 | + scratch_d=$(mktemp -d) |
762 | + cp ${src} ${scratch_d}/resize.img |
763 | + |
764 | + truncate --size=${size}M ${scratch_d}/resize.img |
765 | + python ${streamconverter} ${scratch_d}/resize.img ${destination} |
766 | + modify_vmdk_header ${destination} |
767 | + |
768 | + qemu-img info ${destination} |
769 | + rm -rf ${scratch_d} |
770 | +} |
771 | + |
772 | +create_derivative() { |
773 | + # arg1 is the disk type |
774 | + # arg2 is the new name |
775 | + unset derivative_img |
776 | + case ${1} in |
777 | + uefi) disk_image="binary/boot/disk-uefi.ext4"; |
778 | + dname="${disk_image//-uefi/-$2-uefi}";; |
779 | + *) disk_image="binary/boot/disk.ext4"; |
780 | + dname="${disk_image//.ext4/-$2.ext4}";; |
781 | + esac |
782 | + |
783 | + if [ ! -e ${disk_image} ]; then |
784 | + echo "Did not find ${disk_image}!"; exit 1; |
785 | + fi |
786 | + |
787 | + cp ${disk_image} ${dname} |
788 | + export derivative_img=${dname} |
789 | +} |
790 | + |
791 | +convert_to_qcow2() { |
792 | + apt-get install -qqy qemu-utils |
793 | + |
794 | + src="$1" |
795 | + destination="$2" |
796 | + qemu-img convert -c -O qcow2 -o compat=0.10 "$src" "$destination" |
797 | + qemu-img info "$destination" |
798 | +} |
799 | + |
800 | +replace_grub_root_with_label() { |
801 | + # When update-grub is run, it will detect the disks in the build system. |
802 | + # Instead, we want grub to use the cloudimg-rootfs labelled disk |
803 | + CHROOT_ROOT="$1" |
804 | + |
805 | + sed -i -e "s,root=[^ ]\+,root=LABEL=cloudimg-rootfs," \ |
806 | + "$CHROOT_ROOT/boot/grub/grub.cfg" |
807 | +} |
808 | |
809 | === added directory 'live-build/ubuntu-cpc/hooks' |
810 | === added file 'live-build/ubuntu-cpc/hooks/001-divert-sync.chroot_early' |
811 | --- live-build/ubuntu-cpc/hooks/001-divert-sync.chroot_early 1970-01-01 00:00:00 +0000 |
812 | +++ live-build/ubuntu-cpc/hooks/001-divert-sync.chroot_early 2017-06-01 19:33:22 +0000 |
813 | @@ -0,0 +1,11 @@ |
814 | +#!/bin/sh |
815 | +set -e |
816 | + |
817 | +dpkg-divert --quiet --add --divert /bin/sync.REAL --rename /bin/sync |
818 | +cat > /bin/sync <<'EOF' |
819 | +#! /bin/sh |
820 | +echo "$0: diverted by livecd-rootfs" >&2 |
821 | +exit 0 |
822 | +EOF |
823 | + |
824 | +chmod +x /bin/sync |
825 | |
826 | === added file 'live-build/ubuntu-cpc/hooks/010-write-etc-ec2-version.chroot' |
827 | --- live-build/ubuntu-cpc/hooks/010-write-etc-ec2-version.chroot 1970-01-01 00:00:00 +0000 |
828 | +++ live-build/ubuntu-cpc/hooks/010-write-etc-ec2-version.chroot 2017-06-01 19:33:22 +0000 |
829 | @@ -0,0 +1,4 @@ |
830 | +#!/bin/bash -eux |
831 | + |
832 | +. /etc/os-release |
833 | +echo "Ubuntu $VERSION" > /etc/ec2_version |
834 | |
835 | === added file 'live-build/ubuntu-cpc/hooks/020-pkg-configure.chroot' |
836 | --- live-build/ubuntu-cpc/hooks/020-pkg-configure.chroot 1970-01-01 00:00:00 +0000 |
837 | +++ live-build/ubuntu-cpc/hooks/020-pkg-configure.chroot 2017-06-01 19:33:22 +0000 |
838 | @@ -0,0 +1,28 @@ |
839 | +#!/bin/bash |
840 | +# Configure certain packages |
841 | + |
842 | +## console-setup |
843 | + |
844 | +# Select the fontface |
845 | +printf "%s\t%s\t%s\t%s\n" \ |
846 | + console-setup console-setup/console-setup/fontface47 string "Fixed" debconf-set-selections || |
847 | + { echo "FAILED to setup console fontface"; exit 1; } |
848 | + |
849 | +# Select the code page for font |
850 | +printf "%s\t%s\t%s\t%s\n" \ |
851 | + console-setup console-setup/codesetcode string "Uni2" | debconf-set-selections || |
852 | + { echo "FAILED to setup console code page to Uni2"; exit 1; } |
853 | + |
854 | +# Set Language string for codepage 47 |
855 | +printf "%s\t%s\t%s\t%s\n" \ |
856 | + console-setup console-setup/codeset47 string ". Combined - Latin; Slavic Cyrillic; Greek" | debconf-set-selections || |
857 | + { echo "FAILED to setup codeset47 to proper string"; exti 1; } |
858 | + |
859 | +# Replace the console font and typ ein /etc/default/console-setup |
860 | +sed -i -e 's,^CODESET.*,CODESET="Uni2",g' \ |
861 | + -e 's,^FONTFACE.*,FONTFACE="Fixed",g' \ |
862 | + /etc/default/console-setup |
863 | + |
864 | +# Configure the console-setup |
865 | +dpkg-reconfigure --frontend=noninteractive console-setup || |
866 | + { echo "FAILED to recofigure console-setup"; exit 1; } |
867 | |
868 | === added file 'live-build/ubuntu-cpc/hooks/025-create-groups.chroot' |
869 | --- live-build/ubuntu-cpc/hooks/025-create-groups.chroot 1970-01-01 00:00:00 +0000 |
870 | +++ live-build/ubuntu-cpc/hooks/025-create-groups.chroot 2017-06-01 19:33:22 +0000 |
871 | @@ -0,0 +1,14 @@ |
872 | +#!/bin/bash |
873 | +# |
874 | +# Create the necessary users and set their passwords. If needed, |
875 | +# make sure they belong to the proper groups |
876 | +# |
877 | +# Author: Ben Howard <ben.howard@canonical.com> |
878 | +# Date: 29 Jun 2011 |
879 | +# |
880 | + |
881 | +echo "Adding admin group..." |
882 | +addgroup --system --quiet admin |
883 | + |
884 | +echo "Adding netdev group..." |
885 | +addgroup --system --quiet netdev |
886 | |
887 | === added file 'live-build/ubuntu-cpc/hooks/030-root-tarball.binary' |
888 | --- live-build/ubuntu-cpc/hooks/030-root-tarball.binary 1970-01-01 00:00:00 +0000 |
889 | +++ live-build/ubuntu-cpc/hooks/030-root-tarball.binary 2017-06-01 19:33:22 +0000 |
890 | @@ -0,0 +1,32 @@ |
891 | +#!/bin/bash -ex |
892 | + |
893 | +if [ -n "$SUBARCH" ]; then |
894 | + echo "Skipping rootfs build for subarch flavor build" |
895 | + exit 0 |
896 | +fi |
897 | + |
898 | +. /build/config/functions |
899 | + |
900 | +mkdir binary/boot/filesystem.dir |
901 | +cp -a chroot/* binary/boot/filesystem.dir |
902 | + |
903 | +setup_mountpoint binary/boot/filesystem.dir |
904 | + |
905 | +chroot binary/boot/filesystem.dir dpkg-divert --local --rename /usr/sbin/grub-probe |
906 | +chroot binary/boot/filesystem.dir touch /usr/sbin/grub-probe |
907 | +chroot binary/boot/filesystem.dir chmod +x /usr/sbin/grub-probe |
908 | + |
909 | +env DEBIAN_FRONTEND=noninteractive chroot binary/boot/filesystem.dir apt-get --purge remove --assume-yes '^linux-.*' |
910 | +env DEBIAN_FRONTEND=noninteractive chroot binary/boot/filesystem.dir apt-get --purge remove --assume-yes '^grub-.*' |
911 | +env DEBIAN_FRONTEND=noninteractive chroot binary/boot/filesystem.dir apt-get autoremove --purge --assume-yes |
912 | +chroot binary/boot/filesystem.dir mkdir /lib/modules |
913 | + |
914 | +chroot binary/boot/filesystem.dir rm /usr/sbin/grub-probe |
915 | +chroot binary/boot/filesystem.dir dpkg-divert --remove --local --rename /usr/sbin/grub-probe |
916 | + |
917 | +mv resolv.conf.tmp "binary/boot/filesystem.dir/etc/resolv.conf" |
918 | +umount "binary/boot/filesystem.dir/proc" |
919 | +umount "binary/boot/filesystem.dir/sys" |
920 | +umount "binary/boot/filesystem.dir/dev/pts" |
921 | +umount "binary/boot/filesystem.dir/dev" |
922 | +umount "binary/boot/filesystem.dir/tmp" |
923 | |
924 | === added file 'live-build/ubuntu-cpc/hooks/031-root-xz.binary' |
925 | --- live-build/ubuntu-cpc/hooks/031-root-xz.binary 1970-01-01 00:00:00 +0000 |
926 | +++ live-build/ubuntu-cpc/hooks/031-root-xz.binary 2017-06-01 19:33:22 +0000 |
927 | @@ -0,0 +1,13 @@ |
928 | +#!/bin/bash -ex |
929 | +# vi: ts=4 noexpandtab |
930 | +# |
931 | +# Generate the rootfs.tar.gz and manifest |
932 | + |
933 | +if [ -n "$SUBARCH" ]; then |
934 | + exit 0 |
935 | +fi |
936 | + |
937 | +dpkg-query --admindir=binary/boot/filesystem.dir/var/lib/dpkg -W > livecd.ubuntu-cpc.rootfs.manifest |
938 | + |
939 | +(cd "binary/boot/filesystem.dir/" && tar -c *) | \ |
940 | + xz > "livecd.ubuntu-cpc.rootfs.tar.xz" |
941 | |
942 | === added file 'live-build/ubuntu-cpc/hooks/032-disk-image.binary' |
943 | --- live-build/ubuntu-cpc/hooks/032-disk-image.binary 1970-01-01 00:00:00 +0000 |
944 | +++ live-build/ubuntu-cpc/hooks/032-disk-image.binary 2017-06-01 19:33:22 +0000 |
945 | @@ -0,0 +1,124 @@ |
946 | +#!/bin/bash -ex |
947 | + |
948 | +. /build/config/functions |
949 | + |
950 | +BOOTPART_START= |
951 | +BOOTPART_END= |
952 | +BOOT_MOUNTPOINT= |
953 | +ROOTPART_START=1 |
954 | + |
955 | +case $ARCH:$SUBARCH in |
956 | + ppc64el:*|powerpc:*) |
957 | + echo "POWER disk images are handled separately" |
958 | + exit 0 |
959 | + ;; |
960 | + armhf:raspi2) |
961 | + # matches the size of the snappy image |
962 | + IMAGE_SIZE=$((4*1000*1000*1000)) |
963 | + |
964 | + BOOTPART_START=8192s |
965 | + BOOTPART_END=138M |
966 | + BOOT_MOUNTPOINT=/boot/firmware |
967 | + ;; |
968 | + *) |
969 | + ;; |
970 | +esac |
971 | + |
972 | +create_empty_partition_table() { |
973 | + apt-get install -qqy parted |
974 | + |
975 | + parted "$1" --script -- mklabel msdos |
976 | +} |
977 | + |
978 | +create_empty_partition() { |
979 | + local disk="$1" |
980 | + local part="$2" |
981 | + local start="$3" |
982 | + local end="$4" |
983 | + local type="$5" |
984 | + local bootable="$6" |
985 | + |
986 | + parted_prefix="parted $disk --script --" |
987 | + ${parted_prefix} mkpart primary "$type" "$start" "$end" |
988 | + if [ -n "$bootable" ]; then |
989 | + ${parted_prefix} set "$part" B |
990 | + fi |
991 | + ${parted_prefix} print |
992 | + ${parted_prefix} align-check opt "$part" |
993 | +} |
994 | + |
995 | +disk_image=binary/boot/disk.ext4 |
996 | + |
997 | +create_empty_disk_image "${disk_image}" |
998 | +create_empty_partition_table "${disk_image}" |
999 | + |
1000 | +ROOTPART=1 |
1001 | +ROOT_BOOTABLE=1 |
1002 | +if [ -n "$BOOTPART_START" ]; then |
1003 | + ROOTPART=2 |
1004 | + ROOTPART_START="$BOOTPART_END" |
1005 | + ROOT_BOOTABLE= |
1006 | + create_empty_partition "$disk_image" 1 "$BOOTPART_START" "$BOOTPART_END" fat32 1 |
1007 | +fi |
1008 | +create_empty_partition "${disk_image}" "$ROOTPART" "$ROOTPART_START" -1 ext2 "$ROOT_BOOTABLE" |
1009 | + |
1010 | +mount_image "${disk_image}" "$ROOTPART" |
1011 | + |
1012 | +# Copy the chroot in to the disk |
1013 | +make_ext4_partition "${rootfs_dev_mapper}" |
1014 | +mkdir mountpoint |
1015 | +mount "${rootfs_dev_mapper}" mountpoint |
1016 | + |
1017 | +if [ -n "$BOOT_MOUNTPOINT" ]; then |
1018 | + boot_dev_mapper="${rootfs_dev_mapper%%[0-9]}1" |
1019 | + # assume fat32 for now |
1020 | + mkfs.vfat -n system-boot "$boot_dev_mapper" |
1021 | + mkdir -p "mountpoint/$BOOT_MOUNTPOINT" |
1022 | + mount "$boot_dev_mapper" "mountpoint/$BOOT_MOUNTPOINT" |
1023 | +fi |
1024 | + |
1025 | +cp -a chroot/* mountpoint/ |
1026 | + |
1027 | +setup_mountpoint mountpoint |
1028 | + |
1029 | +case $ARCH:$SUBARCH in |
1030 | + armhf:raspi2) |
1031 | + chroot mountpoint flash-kernel \ |
1032 | + --machine "Raspberry Pi 2 Model B" |
1033 | + # not the best place for this, but neither flash-kernel nor |
1034 | + # u-boot have provisions for installing u-boot via maintainer |
1035 | + # script |
1036 | + /build/config/hooks/raspi2/mkknlimg --dtok \ |
1037 | + mountpoint/usr/lib/u-boot/rpi_2/u-boot.bin \ |
1038 | + mountpoint/boot/firmware/uboot.bin |
1039 | + ;; |
1040 | + *) ;; |
1041 | +esac |
1042 | + |
1043 | +case $ARCH in |
1044 | + amd64|i386) should_install_grub=1;; |
1045 | + *) should_install_grub=0;; |
1046 | +esac |
1047 | + |
1048 | +if [ "${should_install_grub}" -eq 1 ]; then |
1049 | + echo "(hd0) ${loop_device}" > mountpoint/tmp/device.map |
1050 | + chroot mountpoint grub-install ${loop_device} |
1051 | + chroot mountpoint grub-bios-setup \ |
1052 | + --boot-image=i386-pc/boot.img \ |
1053 | + --core-image=i386-pc/core.img \ |
1054 | + --skip-fs-probe \ |
1055 | + --device-map=/tmp/device.map \ |
1056 | + ${loop_device} |
1057 | + |
1058 | + rm mountpoint/tmp/device.map |
1059 | +fi |
1060 | + |
1061 | +if [ -n "$BOOT_MOUNTPOINT" ]; then |
1062 | + umount "mountpoint/$BOOT_MOUNTPOINT" |
1063 | +fi |
1064 | + |
1065 | +umount_partition mountpoint |
1066 | +rmdir mountpoint |
1067 | + |
1068 | +clean_loops |
1069 | +trap - EXIT |
1070 | |
1071 | === added file 'live-build/ubuntu-cpc/hooks/032-root-squashfs.binary' |
1072 | --- live-build/ubuntu-cpc/hooks/032-root-squashfs.binary 1970-01-01 00:00:00 +0000 |
1073 | +++ live-build/ubuntu-cpc/hooks/032-root-squashfs.binary 2017-06-01 19:33:22 +0000 |
1074 | @@ -0,0 +1,19 @@ |
1075 | +#!/bin/bash -ex |
1076 | +# vi: ts=4 noexpandtab |
1077 | +# |
1078 | +# Generate a squashfs root and manifest |
1079 | + |
1080 | +if [ -n "$SUBARCH" ]; then |
1081 | + exit 0 |
1082 | +fi |
1083 | + |
1084 | +apt-get -qqy install squashfs-tools |
1085 | + |
1086 | +squashfs_f="${PWD}/livecd.ubuntu-cpc.squashfs" |
1087 | +squashfs_f_manifest="${squashfs_f}.manifest" |
1088 | + |
1089 | +dpkg-query --admindir=binary/boot/filesystem.dir/var/lib/dpkg -W > ${squashfs_f_manifest} |
1090 | + |
1091 | +(cd "binary/boot/filesystem.dir/" && |
1092 | + mksquashfs . ${squashfs_f} \ |
1093 | + -no-progress -xattrs -comp xz ) |
1094 | |
1095 | === added file 'live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary' |
1096 | --- live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary 1970-01-01 00:00:00 +0000 |
1097 | +++ live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary 2017-06-01 19:33:22 +0000 |
1098 | @@ -0,0 +1,141 @@ |
1099 | +#!/bin/bash -eux |
1100 | + |
1101 | +case $ARCH in |
1102 | + amd64|arm64) |
1103 | + ;; |
1104 | + *) |
1105 | + echo "We don't create EFI images for $ARCH." |
1106 | + exit 0 |
1107 | + ;; |
1108 | +esac |
1109 | + |
1110 | +. /build/config/functions |
1111 | + |
1112 | +apt-get -qqy install dosfstools gdisk |
1113 | + |
1114 | +create_partitions() { |
1115 | + disk_image="$1" |
1116 | + sgdisk "${disk_image}" --zap-all |
1117 | + case $ARCH in |
1118 | + arm64) |
1119 | + sgdisk "${disk_image}" \ |
1120 | + --new=15:0:204800 \ |
1121 | + --typecode=15:ef00 \ |
1122 | + --new=1: |
1123 | + ;; |
1124 | + amd64) |
1125 | + sgdisk "${disk_image}" \ |
1126 | + --new=14::+4M \ |
1127 | + --new=15::+106M \ |
1128 | + --new=1:: |
1129 | + sgdisk "${disk_image}" \ |
1130 | + -t 14:ef02 \ |
1131 | + -t 15:ef00 |
1132 | + ;; |
1133 | + esac |
1134 | + sgdisk "${disk_image}" \ |
1135 | |
1136 | +} |
1137 | + |
1138 | +create_and_mount_uefi_partition() { |
1139 | + uefi_dev="/dev/mapper${loop_device///dev/}p15" |
1140 | + mountpoint="$1" |
1141 | + mkfs.vfat -F 32 -n UEFI "${uefi_dev}" |
1142 | + |
1143 | + mkdir -p "${mountpoint}"/boot/efi |
1144 | + mount "${uefi_dev}" "$mountpoint"/boot/efi |
1145 | + |
1146 | + cat << EOF >> "mountpoint/etc/fstab" |
1147 | +LABEL=UEFI /boot/efi vfat defaults 0 0 |
1148 | +EOF |
1149 | +} |
1150 | + |
1151 | +install_grub() { |
1152 | + mkdir mountpoint |
1153 | + mount_partition "${rootfs_dev_mapper}" mountpoint |
1154 | + |
1155 | + create_and_mount_uefi_partition mountpoint |
1156 | + |
1157 | + echo "(hd0) ${loop_device}" > mountpoint/tmp/device.map |
1158 | + mkdir -p mountpoint/etc/default/grub.d |
1159 | + efi_boot_dir="/boot/efi/EFI/BOOT" |
1160 | + chroot mountpoint mkdir -p "${efi_boot_dir}" |
1161 | + |
1162 | + case $ARCH in |
1163 | + arm64) |
1164 | + chroot mountpoint apt-get -qqy install --no-install-recommends grub-efi-arm64 grub-efi-arm64-bin |
1165 | + grub_modules="part_gpt fat gzio ext2 normal chain boot configfile linux search_fs_uuid search_label terminal serial video video_fb efi_gop" |
1166 | + efi_target=arm64-efi |
1167 | + ;; |
1168 | + amd64) |
1169 | + chroot mountpoint apt-get install -qqy grub-efi-amd64-signed grub-efi-amd64 shim-signed |
1170 | + grub_modules="part_gpt fat ext2 normal chain boot configfile linux multiboot search_fs_uuid search_label terminal serial video video_fb video_bochs usb usb_keyboard efi_gop efi_uga" |
1171 | + efi_target=x86_64-efi |
1172 | + ;; |
1173 | + esac |
1174 | + |
1175 | + cat << EOF >> mountpoint/etc/default/grub.d/50-cloudimg-settings.cfg |
1176 | +${CLOUD_IMG_STR} |
1177 | +# For Cloud Image compatability |
1178 | +GRUB_PRELOAD_MODULES="${grub_modules}" |
1179 | +EOF |
1180 | + chroot mountpoint grub-install "${loop_device}" \ |
1181 | + --boot-directory=/boot \ |
1182 | + --efi-directory=/boot/efi \ |
1183 | + --target=${efi_target} \ |
1184 | + --removable \ |
1185 | + --uefi-secure-boot \ |
1186 | + --no-nvram \ |
1187 | + --modules="${grub_modules}" |
1188 | + |
1189 | + if [ -f mountpoint/boot/efi/EFI/BOOT/grub.cfg ]; then |
1190 | + sed -i "s| root| root hd0,gpt1|" mountpoint/boot/efi/EFI/BOOT/grub.cfg |
1191 | + sed -i "1i${CLOUD_IMG_STR}" mountpoint/boot/efi/EFI/BOOT/grub.cfg |
1192 | + # For some reason the grub disk is looking for /boot/grub/grub.cfg on |
1193 | + # part 15.... |
1194 | + chroot mountpoint mkdir -p /boot/efi/boot/grub |
1195 | + chroot mountpoint cp /boot/efi/EFI/BOOT/grub.cfg /boot/efi/boot/grub |
1196 | + fi |
1197 | + |
1198 | + if [ "$ARCH" = "amd64" ]; then |
1199 | + # Install the BIOS/GPT bits. Since GPT boots from the ESP partition, |
1200 | + # it means that we just run this simple command and we're done |
1201 | + chroot mountpoint grub-install --target=i386-pc "${loop_device}" |
1202 | + fi |
1203 | + |
1204 | + chroot mountpoint dpkg-divert --local --rename /etc/grub.d/30_os-prober |
1205 | + chroot mountpoint update-grub |
1206 | + replace_grub_root_with_label mountpoint |
1207 | + chroot mountpoint dpkg-divert --remove --local --rename /etc/grub.d/30_os-prober |
1208 | + |
1209 | + chroot mountpoint apt-get -y clean |
1210 | + chroot mountpoint apt-get -y update |
1211 | + |
1212 | + rm mountpoint/tmp/device.map |
1213 | + sync |
1214 | + umount mountpoint/boot/efi |
1215 | + sleep 5 |
1216 | + udevadm settle |
1217 | + mount |
1218 | + umount_partition mountpoint |
1219 | + rmdir mountpoint |
1220 | +} |
1221 | + |
1222 | +disk_image=binary/boot/disk-uefi.ext4 |
1223 | + |
1224 | +create_empty_disk_image "${disk_image}" |
1225 | +create_partitions "${disk_image}" |
1226 | +mount_image "${disk_image}" 1 |
1227 | + |
1228 | +# Copy the chroot in to the disk |
1229 | +make_ext4_partition "${rootfs_dev_mapper}" |
1230 | +mkdir mountpoint |
1231 | +mount "${rootfs_dev_mapper}" mountpoint |
1232 | +cp -a chroot/* mountpoint/ |
1233 | +umount mountpoint |
1234 | +rmdir mountpoint |
1235 | + |
1236 | +install_grub |
1237 | + |
1238 | +clean_loops |
1239 | +trap - EXIT |
1240 | |
1241 | === added file 'live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary' |
1242 | --- live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary 1970-01-01 00:00:00 +0000 |
1243 | +++ live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary 2017-06-01 19:33:22 +0000 |
1244 | @@ -0,0 +1,79 @@ |
1245 | +#!/bin/bash -eux |
1246 | +case $ARCH in |
1247 | + ppc64el|powerpc) |
1248 | + ;; |
1249 | + *) |
1250 | + exit 0 |
1251 | + ;; |
1252 | +esac |
1253 | + |
1254 | +. /build/config/functions |
1255 | + |
1256 | +create_partitions() { |
1257 | + disk_image="$1" |
1258 | + apt-get install -qqy gdisk |
1259 | + sgdisk "${disk_image}" \ |
1260 | + --zap-all |
1261 | + sgdisk "${disk_image}" \ |
1262 | + --new=2::+8M \ |
1263 | + --new=1: |
1264 | + sgdisk "${disk_image}" -t 2:4100 |
1265 | + sgdisk "${disk_image}" \ |
1266 | |
1267 | +} |
1268 | + |
1269 | +install_grub() { |
1270 | + mkdir mountpoint |
1271 | + mount_partition "${rootfs_dev_mapper}" mountpoint |
1272 | + |
1273 | + chroot mountpoint apt-get -qqy update |
1274 | + chroot mountpoint apt-get -qqy install grub2 |
1275 | + chroot mountpoint apt-get -qqy remove --purge grub-legacy-ec2 |
1276 | + |
1277 | + # set the kernel commandline to use hvc0 |
1278 | + mkdir -p mountpoint/etc/default/grub.d |
1279 | + cat << EOF > mountpoint/etc/default/grub.d/50-cloudimg-settings.cfg |
1280 | +${CLOUD_IMG_STR} |
1281 | + |
1282 | +# Set the recordfail timeout |
1283 | +GRUB_RECORDFAIL_TIMEOUT=0 |
1284 | + |
1285 | +# Do not wait on grub prompt |
1286 | +GRUB_TIMEOUT=0 |
1287 | + |
1288 | +# Set the default commandline |
1289 | +GRUB_CMDLINE_LINUX_DEFAULT="console=hvc0 earlyprintk" |
1290 | +EOF |
1291 | + prep_partition="/dev/mapper${loop_device///dev/}p2" |
1292 | + chroot mountpoint grub-install "${prep_partition}" \ |
1293 | + --no-nvram \ |
1294 | + --boot-directory=/boot \ |
1295 | + --target=powerpc-ieee1275 |
1296 | + |
1297 | + chroot mountpoint dpkg-divert --local --rename /etc/grub.d/30_os-prober |
1298 | + chroot mountpoint update-grub |
1299 | + replace_grub_root_with_label mountpoint |
1300 | + chroot mountpoint dpkg-divert --remove --local --rename /etc/grub.d/30_os-prober |
1301 | + |
1302 | + umount_partition mountpoint |
1303 | + rmdir mountpoint |
1304 | +} |
1305 | + |
1306 | +disk_image=binary/boot/disk.ext4 |
1307 | + |
1308 | +create_empty_disk_image "${disk_image}" |
1309 | +create_partitions "${disk_image}" |
1310 | +mount_image "${disk_image}" 1 |
1311 | + |
1312 | +# Copy the chroot in to the disk |
1313 | +make_ext4_partition "${rootfs_dev_mapper}" |
1314 | +mkdir mountpoint |
1315 | +mount "${rootfs_dev_mapper}" mountpoint |
1316 | +cp -a chroot/* mountpoint/ |
1317 | +umount mountpoint |
1318 | +rmdir mountpoint |
1319 | + |
1320 | +install_grub |
1321 | + |
1322 | +clean_loops |
1323 | +trap - EXIT |
1324 | |
1325 | === added file 'live-build/ubuntu-cpc/hooks/040-qcow2-image.binary' |
1326 | --- live-build/ubuntu-cpc/hooks/040-qcow2-image.binary 1970-01-01 00:00:00 +0000 |
1327 | +++ live-build/ubuntu-cpc/hooks/040-qcow2-image.binary 2017-06-01 19:33:22 +0000 |
1328 | @@ -0,0 +1,23 @@ |
1329 | +#!/bin/bash -ex |
1330 | + |
1331 | +case $ARCH:$SUBARCH in |
1332 | + # Not sure if any other cloud images use subarch for something that |
1333 | + # should take qcow2 format, so only skipping this on raspi2 for now. |
1334 | + armhf:raspi2) |
1335 | + apt-get install -qqy pxz |
1336 | + pxz -T4 -c binary/boot/disk.ext4 > livecd.ubuntu-cpc.disk1.img.xz |
1337 | + exit 0 |
1338 | + ;; |
1339 | +esac |
1340 | + |
1341 | +apt-get install -qqy qemu-utils |
1342 | + |
1343 | +. /build/config/functions |
1344 | + |
1345 | +if [ -f binary/boot/disk.ext4 ]; then |
1346 | + convert_to_qcow2 binary/boot/disk.ext4 livecd.ubuntu-cpc.disk1.img |
1347 | +fi |
1348 | + |
1349 | +if [ -f binary/boot/disk-uefi.ext4 ]; then |
1350 | + convert_to_qcow2 binary/boot/disk-uefi.ext4 livecd.ubuntu-cpc.uefi1.img |
1351 | +fi |
1352 | |
1353 | === added file 'live-build/ubuntu-cpc/hooks/040-vmdk-image.binary' |
1354 | --- live-build/ubuntu-cpc/hooks/040-vmdk-image.binary 1970-01-01 00:00:00 +0000 |
1355 | +++ live-build/ubuntu-cpc/hooks/040-vmdk-image.binary 2017-06-01 19:33:22 +0000 |
1356 | @@ -0,0 +1,22 @@ |
1357 | +#!/bin/bash -eux |
1358 | +# vi: ts=4 expandtab |
1359 | +# |
1360 | +# Generate VMDK files |
1361 | + |
1362 | +extension="disk1.vmdk" |
1363 | + |
1364 | +case $ARCH in |
1365 | + i386|amd64) ;; |
1366 | + *) echo "VMDK images are not supported for $ARCH yet."; |
1367 | + exit 0;; |
1368 | +esac |
1369 | + |
1370 | +. /build/config/functions |
1371 | + |
1372 | +if [ -e binary/boot/disk.ext4 ]; then |
1373 | + create_vmdk binary/boot/disk.ext4 livecd.ubuntu-cpc.disk1.vmdk |
1374 | +fi |
1375 | + |
1376 | +if [ -e binary/boot/disk-uefi.ext4 ]; then |
1377 | + create_vmdk binary/boot/disk-uefi.ext4 livecd.ubuntu-cpc.uefi.vmdk |
1378 | +fi |
1379 | |
1380 | === added file 'live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary' |
1381 | --- live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary 1970-01-01 00:00:00 +0000 |
1382 | +++ live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary 2017-06-01 19:33:22 +0000 |
1383 | @@ -0,0 +1,105 @@ |
1384 | +#!/bin/bash -eux |
1385 | +# vi: ts=4 expandtab |
1386 | +# |
1387 | +# Generate OVA images |
1388 | +# |
1389 | +# OVA images are, by defintiion a tarball consisting of a disk image, OVF file |
1390 | +# and checksums. This step produces an OVA that is suitable for use with |
1391 | +# Cloud's that support the OVF specification. |
1392 | +# |
1393 | +# For this step, we re-use the VMDK's made in 040-vmdk-image.binary |
1394 | + |
1395 | + |
1396 | +# Switch on $ARCH to determine which ID and description to use in the produced |
1397 | +# OVF. We have fancy Ubuntu-specific IDs in the OVF specification, we might as |
1398 | +# well use them. |
1399 | +case $ARCH in |
1400 | + amd64) |
1401 | + ovf_id=94 |
1402 | + ovf_os_type="ubuntu64Guest" |
1403 | + ovf_desc_bits=64 ;; |
1404 | + i386) |
1405 | + ovf_id=93 |
1406 | + ovf_os_type="ubuntu32Guest" |
1407 | + ovf_desc_bits=32 ;; |
1408 | + *) |
1409 | + echo "OVA images are not supported for $ARCH yet."; |
1410 | + exit 0;; |
1411 | +esac |
1412 | + |
1413 | +cur_d=${PWD} |
1414 | +my_d=$(dirname $(readlink -f ${0})) |
1415 | + |
1416 | +base_vmdk="livecd.ubuntu-cpc.disk1.vmdk" |
1417 | +if [ "$ARCH" = "amd64" ]; then |
1418 | + base_vmdk="livecd.ubuntu-cpc.uefi.vmdk" |
1419 | +fi |
1420 | + |
1421 | +if [ ! -e ${base_vmdk} ]; then |
1422 | + find . | grep vmdk |
1423 | + exit 0 |
1424 | +fi |
1425 | + |
1426 | +# Lets be safe about this |
1427 | +scratch_d=$(mktemp -d) |
1428 | +trap "rm -rf ${scratch_d}" EXIT |
1429 | + |
1430 | +# Used to identify bits |
1431 | +suite=$(chroot chroot lsb_release -c -s) |
1432 | +version=$(chroot chroot lsb_release --release --short) |
1433 | +distro=$(chroot chroot lsb_release --id --short | tr [:upper:] [:lower:]) |
1434 | + |
1435 | +# Put our vmdk in place for OVA conversion |
1436 | +prefix="${distro}-${suite}-${version}-cloudimg" |
1437 | +vmdk_f="${scratch_d}/${prefix}.vmdk" |
1438 | +cp ${base_vmdk} ${vmdk_f} |
1439 | + |
1440 | +# Get information about the VMDK |
1441 | +vmdk_size=$(du -b "${vmdk_f}" | cut -f1) |
1442 | +vmdk_capacity=$(qemu-img info "${vmdk_f}" | awk '-F[\( ]' '$1 ~ /virtual/ && $NF ~ /bytes.*/ {print$(NF-1)}') |
1443 | + |
1444 | +# Populate the OVF template |
1445 | +ovf="${scratch_d}/${prefix}.ovf" |
1446 | +cp ${my_d}/ovf/ubuntu-ova-v1-vmdk.tmpl ${ovf} |
1447 | +serial_stamp=$(date +%Y%m%d) |
1448 | +sed -i "${ovf}" \ |
1449 | + -e "s/@@NAME@@/${prefix}-${serial_stamp}/g" \ |
1450 | + -e "s/@@FILENAME@@/${vmdk_f##*/}/g" \ |
1451 | + -e "s/@@VMDK_FILE_SIZE@@/${vmdk_size}/g" \ |
1452 | + -e "s/@@VMDK_CAPACITY@@/${vmdk_capacity}/g" \ |
1453 | + -e "s/@@NUM_CPUS@@/2/g" \ |
1454 | + -e "s/@@VERSION@@/${version}/g" \ |
1455 | + -e "s/@@DATE@@/${serial_stamp}/g" \ |
1456 | + -e "s/@@MEM_SIZE@@/1024/g" \ |
1457 | + -e "s/@@OVF_ID@@/${ovf_id}/g" \ |
1458 | + -e "s/@@OVF_OS_TYPE@@/${ovf_os_type}/g" \ |
1459 | + -e "s/@@OVF_DESC_BITS@@/${ovf_desc_bits}/g" |
1460 | + |
1461 | +# Get the checksums |
1462 | +vmdk_sha256=$(sha256sum ${vmdk_f} | cut -d' ' -f1) |
1463 | +ovf_sha256=$(sha256sum ${ovf} | cut -d' ' -f1) |
1464 | + |
1465 | +# Generate the manifest |
1466 | +manifest="${scratch_d}/${prefix}.mf" |
1467 | +cat > "${manifest}" <<EOF |
1468 | +SHA256(${vmdk_f##*/})= ${vmdk_sha256} |
1469 | +SHA256(${ovf##*/})= ${ovf_sha256} |
1470 | +EOF |
1471 | + |
1472 | +# Now create the OVA |
1473 | +echo "Creating OVA with the following attributes:" |
1474 | +cat <<EOM |
1475 | +OVA information: |
1476 | + Name: ${prefix} |
1477 | + Size: ${vmdk_size} |
1478 | + Capacity: ${vmdk_capacity} |
1479 | + VMDK Name: ${vmdk_f##*/} |
1480 | + VMDK SHA256: ${vmdk_sha256} |
1481 | + OVF SHA256: ${ovf_sha256} |
1482 | +EOM |
1483 | + |
1484 | +tar -C ${scratch_d} \ |
1485 | + -cf ${cur_d}/livecd.ubuntu-cpc.ova \ |
1486 | + ${prefix}.ovf \ |
1487 | + ${prefix}.mf \ |
1488 | + ${vmdk_f##*/} |
1489 | |
1490 | === added file 'live-build/ubuntu-cpc/hooks/042-vagrant.binary' |
1491 | --- live-build/ubuntu-cpc/hooks/042-vagrant.binary 1970-01-01 00:00:00 +0000 |
1492 | +++ live-build/ubuntu-cpc/hooks/042-vagrant.binary 2017-06-01 19:33:22 +0000 |
1493 | @@ -0,0 +1,221 @@ |
1494 | +#!/bin/bash -ex |
1495 | +# vi: ts=4 noexpandtab |
1496 | +# |
1497 | +# Generate a generic Vagrant Box. |
1498 | +# |
1499 | +# Vagrant images are essentially nothing more than OVA's with extra-metadata |
1500 | +# and some preinstalled packages. |
1501 | +# |
1502 | +# We can't use the OVA's for Vagrant since Vagrant uses SSH to modify the |
1503 | +# instance. This build step creates a cloud-config ISO so that Cloud-Init |
1504 | +# will configure the initial user, creates meta-data that tells Vagrant how |
1505 | +# to interact with the cloud-init created users, and finally create the OVA. |
1506 | +# |
1507 | +# For this step, we make a deriviative of binary/boot/disk.ext4 and install |
1508 | +# some packages in it, convert it to a vmdk, and then assemble the vagrant |
1509 | +# box. |
1510 | + |
1511 | +cur_d=${PWD} |
1512 | +my_d=$(dirname $(readlink -f ${0})) |
1513 | + |
1514 | +# Switch on $ARCH to determine which ID and description to use in the produced |
1515 | +# OVF. We have fancy Ubuntu-specific IDs in the OVF specification, we might as |
1516 | +# well use them. |
1517 | +case $ARCH in |
1518 | + amd64) |
1519 | + ovf_id=94 |
1520 | + ovf_os_type="ubuntu64Guest" |
1521 | + ovf_desc_bits=64 ;; |
1522 | + i386) |
1523 | + ovf_id=93 |
1524 | + ovf_os_type="ubuntu32Guest" |
1525 | + ovf_desc_bits=32 ;; |
1526 | + *) |
1527 | + echo "Vagrant images are not supported for $ARCH yet." |
1528 | + exit 0;; |
1529 | +esac |
1530 | + |
1531 | +. /build/config/functions |
1532 | + |
1533 | +# Virtualbox is needed for making a small VMDK |
1534 | +apt-get -qqy install genisoimage qemu-utils |
1535 | + |
1536 | +# Lets be safe about this |
1537 | +box_d=$(mktemp -d) |
1538 | +seed_d=$(mktemp -d) |
1539 | +mount_d=$(mktemp -d) |
1540 | + |
1541 | +create_derivative "disk" "vagrant" #sets ${derivative_img} |
1542 | +mount_disk_image ${derivative_img} ${mount_d} |
1543 | + |
1544 | +cleanup_vagrant() { |
1545 | + if [ -d "$mount_d" ]; then |
1546 | + umount_disk_image "$mount_d" |
1547 | + fi |
1548 | + rm -rf ${box_d} ${seed_d} ${mount_d} ${derivative_img} |
1549 | +} |
1550 | +trap cleanup_vagrant EXIT |
1551 | + |
1552 | +chroot ${mount_d} apt-get update |
1553 | +# virtualbox-guest-utils Recommends: virtualbox-guest-x11, which we want to |
1554 | +# avoid pulling into a cloud image. |
1555 | +chroot ${mount_d} apt-get install --no-install-recommends -y virtualbox-guest-utils |
1556 | +chroot ${mount_d} apt-get clean |
1557 | +umount_disk_image "$mount_d" |
1558 | +rmdir "$mount_d" |
1559 | + |
1560 | +# Used to identify bits |
1561 | +suite=$(chroot chroot lsb_release -c -s) |
1562 | +version=$(chroot chroot lsb_release --release --short) |
1563 | +distro=$(chroot chroot lsb_release --id --short | tr [:upper:] [:lower:]) |
1564 | + |
1565 | +# Get the VMDK in place |
1566 | +prefix="${distro}-${suite}-${version}-cloudimg" |
1567 | +vmdk_f="${box_d}/${prefix}.vmdk" |
1568 | +create_vmdk ${derivative_img} ${vmdk_f} |
1569 | + |
1570 | +# Vagrant needs a base user. We either inject the well-known SSH key |
1571 | +# or use password authentication. Both are ugly. So we'll use a password |
1572 | +# and make it random. This obviously is insecure...but at least its |
1573 | +# better than the alternatives. |
1574 | +ubuntu_user_pass=$(openssl rand -hex 12) |
1575 | + |
1576 | +#################################### |
1577 | +# Create the ConfigDrive |
1578 | +# This is a cloud-init piece that instructs cloud-init to configure |
1579 | +# a default user at first boot. |
1580 | + |
1581 | +cdrom_vmdk_f="${box_d}/${prefix}-configdrive.vmdk" |
1582 | + |
1583 | +# Create the user-data. This is totally insecure, but so is Vagrant. To |
1584 | +# mitigate this insecurity, the vagrant instance is not accessible |
1585 | +# except via local host. |
1586 | +cat > ${seed_d}/user-data <<END |
1587 | +#cloud-config |
1588 | +password: ${ubuntu_user_pass} |
1589 | +chpasswd: { expire: False } |
1590 | +ssh_pwauth: True |
1591 | +manage_etc_hosts: localhost |
1592 | +END |
1593 | + |
1594 | +# Create the fake meta-data |
1595 | +cat > ${seed_d}/meta-data <<END |
1596 | +instance-id: iid-$(openssl rand -hex 8) |
1597 | +local-hostname: ubuntu-${suite} |
1598 | +END |
1599 | + |
1600 | +# Pad the cdrom, otherwise the VMDK will be invalid |
1601 | +dd if=/dev/zero of=${seed_d}/bloat_file bs=1M count=10 |
1602 | + |
1603 | +# Create the ISO |
1604 | +genisoimage \ |
1605 | + -output ${seed_d}/seed.iso \ |
1606 | + -volid cidata \ |
1607 | + -joliet -rock \ |
1608 | + -input-charset utf-8 \ |
1609 | + ${seed_d}/user-data \ |
1610 | + ${seed_d}/meta-data |
1611 | + |
1612 | +# Make a VMDK out of the seed file. |
1613 | +create_vmdk ${seed_d}/seed.iso ${cdrom_vmdk_f} 10 |
1614 | + |
1615 | +### END Create ConfigDrive |
1616 | +########################## |
1617 | + |
1618 | +########################## |
1619 | +# VAGRANT meta-data |
1620 | + |
1621 | +# Create the Vagrant file. This file is used by Vagrant to define how |
1622 | +# Vagrant uses Virtualbox and how Vagrant interacts with the host. |
1623 | +macaddr="02$(openssl rand -hex 5 | tr [:lower:] [:upper:])" |
1624 | +cat > ${box_d}/Vagrantfile <<EOF |
1625 | +# Front load the includes |
1626 | +include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__) |
1627 | +load include_vagrantfile if File.exist?(include_vagrantfile) |
1628 | + |
1629 | +Vagrant.configure("2") do |config| |
1630 | + config.vm.base_mac = "${macaddr}" |
1631 | + config.ssh.username = "ubuntu" |
1632 | + config.ssh.password = "${ubuntu_user_pass}" |
1633 | + |
1634 | + config.vm.provider "virtualbox" do |vb| |
1635 | + vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ] |
1636 | + vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "${prefix}-console.log") ] |
1637 | + end |
1638 | +end |
1639 | +EOF |
1640 | + |
1641 | +# Tag it as a Virtualbox Vagrant |
1642 | +cat > ${box_d}/metadata.json <<EOF |
1643 | +{ |
1644 | + "provider": "virtualbox" |
1645 | +} |
1646 | +EOF |
1647 | + |
1648 | +# END |
1649 | +########################## |
1650 | + |
1651 | +########################## |
1652 | +# Create the actual box |
1653 | + |
1654 | +# Get information about the disks for the OVF |
1655 | +vmdk_size=$(du -b "${vmdk_f}" | cut -f1) |
1656 | +vmdk_capacity=$(qemu-img info "${vmdk_f}" | awk '-F[\( ]' '$1 ~ /virtual/ && $NF ~ /bytes.*/ {print$(NF-1)}') |
1657 | +vmdk_sha256=$(sha256sum ${vmdk_f} | cut -d' ' -f1) |
1658 | + |
1659 | +cdrom_size=$(du -b "${cdrom_vmdk_f}" | cut -f1) |
1660 | +cdrom_capacity=$(qemu-img info "${cdrom_vmdk_f}" | awk '-F[\( ]' '$1 ~ /virtual/ && $NF ~ /bytes.*/ {print$(NF-1)}') |
1661 | +cdrom_sha256=$(sha256sum ${cdrom_vmdk_f} | cut -d' ' -f1) |
1662 | + |
1663 | +# Populate the OVF template |
1664 | +ovf="${box_d}/box.ovf" |
1665 | +cp ${my_d}/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl ${ovf} |
1666 | +serial_stamp=$(date +%Y%m%d) |
1667 | +sed -i "${ovf}" \ |
1668 | + -e "s/@@NAME@@/${prefix}-${serial_stamp}/g" \ |
1669 | + -e "s/@@FILENAME1@@/${vmdk_f##*/}/g" \ |
1670 | + -e "s/@@VMDK_FILE_SIZE@@/${vmdk_size}/g" \ |
1671 | + -e "s/@@VMDK_CAPACITY@@/${vmdk_capacity}/g" \ |
1672 | + -e "s/@@FILENAME2@@/${cdrom_vmdk_f##*/}/g" \ |
1673 | + -e "s/@@VMDK_FILE_SIZE2@@/${cdrom_size}/g" \ |
1674 | + -e "s/@@VMDK_CAPACITY2@@/${cdrom_capacity}/g" \ |
1675 | + -e "s/@@NUM_CPUS@@/2/g" \ |
1676 | + -e "s/@@VERSION@@/${version}/g" \ |
1677 | + -e "s/@@DATE@@/${serial_stamp}/g" \ |
1678 | + -e "s/@@MEM_SIZE@@/1024/g" \ |
1679 | + -e "s/@@OVF_ID@@/${ovf_id}/g" \ |
1680 | + -e "s/@@OVF_OS_TYPE@@/${ovf_os_type}/g" \ |
1681 | + -e "s/@@OVF_DESC_BITS@@/${ovf_desc_bits}/g" |
1682 | + |
1683 | +ovf_sha256=$(sha256sum ${ovf} | cut -d' ' -f1) |
1684 | + |
1685 | +# Generate the manifest |
1686 | +manifest="${box_d}/${prefix}.mf" |
1687 | +cat > "${manifest}" <<EOF |
1688 | +SHA256(${vmdk_f##*/})= ${vmdk_sha256} |
1689 | +SHA256(${cdrom_vmdk_f##*/})= ${cdrom_sha256} |
1690 | +SHA256(${ovf##*/})= ${ovf_sha256} |
1691 | +EOF |
1692 | + |
1693 | +# Now create the box |
1694 | +echo "Creating OVA with the following attributes:" |
1695 | +cat <<EOM |
1696 | +OVA information: |
1697 | + Name: ${prefix} |
1698 | + Size: ${vmdk_size} |
1699 | + VMDK Name: ${vmdk_f##*/} |
1700 | + VMDK Capacity: ${vmdk_capacity} |
1701 | + VMDK SHA256: ${vmdk_sha256} |
1702 | + CDROM Name: ${cdrom_vmdk_f##*/} |
1703 | + CDROM Capacity: ${cdrom_capacity} |
1704 | + CDROM SHA256: ${cdrom_sha256} |
1705 | +EOM |
1706 | + |
1707 | +tar -C ${box_d} \ |
1708 | + -cf ${cur_d}/livecd.ubuntu-cpc.vagrant.box \ |
1709 | + box.ovf \ |
1710 | + Vagrantfile \ |
1711 | + metadata.json \ |
1712 | + ${prefix}.mf \ |
1713 | + ${vmdk_f##*/} \ |
1714 | + ${cdrom_vmdk_f##*/} |
1715 | |
1716 | === added file 'live-build/ubuntu-cpc/hooks/051-hwclock.chroot' |
1717 | --- live-build/ubuntu-cpc/hooks/051-hwclock.chroot 1970-01-01 00:00:00 +0000 |
1718 | +++ live-build/ubuntu-cpc/hooks/051-hwclock.chroot 2017-06-01 19:33:22 +0000 |
1719 | @@ -0,0 +1,3 @@ |
1720 | +#!/bin/bash |
1721 | + |
1722 | +printf "HWCLOCKACCESS=no" >> /etc/default/rcS |
1723 | |
1724 | === added file 'live-build/ubuntu-cpc/hooks/052-ssh_authentication.chroot' |
1725 | --- live-build/ubuntu-cpc/hooks/052-ssh_authentication.chroot 1970-01-01 00:00:00 +0000 |
1726 | +++ live-build/ubuntu-cpc/hooks/052-ssh_authentication.chroot 2017-06-01 19:33:22 +0000 |
1727 | @@ -0,0 +1,3 @@ |
1728 | +#!/bin/bash |
1729 | + |
1730 | +sed -i "s|#PasswordAuthentication yes|PasswordAuthentication no|g" /etc/ssh/sshd_config |
1731 | |
1732 | === added file 'live-build/ubuntu-cpc/hooks/060-ipv6.chroot' |
1733 | --- live-build/ubuntu-cpc/hooks/060-ipv6.chroot 1970-01-01 00:00:00 +0000 |
1734 | +++ live-build/ubuntu-cpc/hooks/060-ipv6.chroot 2017-06-01 19:33:22 +0000 |
1735 | @@ -0,0 +1,18 @@ |
1736 | +#!/bin/bash |
1737 | +# |
1738 | +# Disable IPv6 privacy extensions on Utopic and later |
1739 | +# |
1740 | + |
1741 | +codename=$(sh -c 'lsb_release --short --codename') |
1742 | +dist_ge() { [[ "$1" > "$2" || "$1" == "$2" ]]; } |
1743 | + |
1744 | +if ! dist_ge "${codename}" "trusty"; then |
1745 | + exit 0 |
1746 | +fi |
1747 | + |
1748 | +cat << EOF > /etc/sysctl.d/99-cloudimg-ipv6.conf |
1749 | +# Written by the Cloud Image build process |
1750 | +# See https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1068756 |
1751 | +net.ipv6.conf.all.use_tempaddr = 0 |
1752 | +net.ipv6.conf.default.use_tempaddr = 0 |
1753 | +EOF |
1754 | |
1755 | === added file 'live-build/ubuntu-cpc/hooks/099-cleanup.chroot' |
1756 | --- live-build/ubuntu-cpc/hooks/099-cleanup.chroot 1970-01-01 00:00:00 +0000 |
1757 | +++ live-build/ubuntu-cpc/hooks/099-cleanup.chroot 2017-06-01 19:33:22 +0000 |
1758 | @@ -0,0 +1,57 @@ |
1759 | +#!/bin/bash |
1760 | + |
1761 | +# Clean up extraneous log files that may be left around |
1762 | +rm /etc/ssh/ssh_host*key* || echo "No SSH keys to remove" |
1763 | + |
1764 | +# Fix LP: #1047707, 1019338 |
1765 | +# Truncate logs that are owned, otherwise remove |
1766 | +whitelisted_logs=(/var/log/btmp /var/log/lastlog /var/log/wtmp /var/log/fsck/checkfs /var/log/fsck/checkroot) |
1767 | + |
1768 | +for log in $(find /var/log -type f) |
1769 | +do |
1770 | + whitelisted=$(echo "${whitelisted_logs[@]}" | grep -o ${log}) |
1771 | + |
1772 | + if [ -n "${whitelisted}" ]; then |
1773 | + : > ${log} && |
1774 | + echo "Truncated whitelisted log ${log}" || |
1775 | + echo "Failed to truncate whitelisted log ${log}" |
1776 | + else |
1777 | + |
1778 | + dpkg -S ${log} > /dev/null 2>&1 && |
1779 | + { : > ${log} || |
1780 | + echo "Failed to truncate $f"; } || |
1781 | + { rm ${log} && |
1782 | + echo "Removed ${log} as an orphaned log file" || |
1783 | + echo "Failed to remove unnecessary log $f"; } |
1784 | + fi |
1785 | +done |
1786 | + |
1787 | +# Remove un-owned log directories |
1788 | +whitelisted_dirs=(/var/log/fsck) |
1789 | + |
1790 | +for log_d in $(find /var/log/* -type d) |
1791 | +do |
1792 | + whitelisted=$(echo "${whitelisted_dirs[@]}" | grep -o "${log_d}") |
1793 | + if [ -z "${whitelisted}" ]; then |
1794 | + dpkg -S ${log_d} > /dev/null 2>&1 && |
1795 | + echo "Preserving log directory ${log_d}" || |
1796 | + { rm -rf ${log_d} && |
1797 | + echo "Removed log directory ${log_d} as orphaned log dir" || |
1798 | + echo "Failed to remove unnessasary log dir ${log_d}"; } |
1799 | + |
1800 | + else |
1801 | + echo "Preserving whitelisted directory ${log_d}" |
1802 | + fi |
1803 | + |
1804 | +done |
1805 | + |
1806 | + |
1807 | +rm -rf /var/run/* || echo "Failed to clean /var/run/*" |
1808 | +rm /etc/passwd- || echo "No spare passwd file to cleanup" |
1809 | +rm /etc/shadow- || echo "No spare shadow file to cleanup" |
1810 | +rm /etc/gshadow- || echo "No spare gshadow file to cleanup" |
1811 | +rm /etc/group- || echo "No spare group file to clenaup" |
1812 | +rm -f /etc/apt/conf.d/00secure || echo "No apt cache to cleanup" |
1813 | + |
1814 | +# Truncate instead of delete, LP: #707311 |
1815 | +truncate --size=0 -c /etc/popularity-contest.conf |
1816 | |
1817 | === added file 'live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot' |
1818 | --- live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot 1970-01-01 00:00:00 +0000 |
1819 | +++ live-build/ubuntu-cpc/hooks/999-cpc-fixes.chroot 2017-06-01 19:33:22 +0000 |
1820 | @@ -0,0 +1,312 @@ |
1821 | +#!/bin/bash -x |
1822 | +rootd="${1:-/}" |
1823 | +root_fs_label=cloudimg-rootfs |
1824 | +set -ex |
1825 | + |
1826 | +CLOUD_IMG_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" |
1827 | + |
1828 | +LANG=C |
1829 | + |
1830 | +_xchroot() { |
1831 | + # Prevent multiple chroots |
1832 | + if [ "$1" = "/" ]; then |
1833 | + shift; |
1834 | + "$@" |
1835 | + else |
1836 | + chroot "$@" |
1837 | + fi |
1838 | +} |
1839 | + |
1840 | +#### COMMON architecture independent functions |
1841 | +arch=$(_xchroot "${rootd}" dpkg --print-architecture) |
1842 | + |
1843 | +add_serial_console() { |
1844 | + condev=$1 |
1845 | + idir="$rootd/etc/init" |
1846 | + cat << EOF > "${idir}/${condev}.conf" |
1847 | +# CONDEV - getty |
1848 | +# |
1849 | +# This service maintains a getty on CONDEV from the point the system is |
1850 | +# started until it is shut down again. |
1851 | + |
1852 | +start on stopped rc RUNLEVEL=[2345] and ( |
1853 | + not-container or |
1854 | + container CONTAINER=lxc or |
1855 | + container CONTAINER=lxc-libvirt) |
1856 | + |
1857 | +stop on runlevel [!2345] |
1858 | + |
1859 | +pre-start script |
1860 | + # getty will not be started if the serial console is not present |
1861 | + stty -F /dev/CONDEV -a 2> /dev/null > /dev/null || { stop ; exit 0; } |
1862 | +end script |
1863 | + |
1864 | +respawn |
1865 | +script |
1866 | + exec /sbin/getty -L CONDEV 115200 vt102 |
1867 | +end script |
1868 | +${CLOUD_IMG_STR} |
1869 | +EOF |
1870 | + sed -i "s/CONDEV/${condev}/g" "$idir/${condev}.conf" |
1871 | +} |
1872 | + |
1873 | +fake_cloud_init() { |
1874 | + # If the cloud does not provide a meta-data service this should be run |
1875 | + # This will setup a nocloud datasource. |
1876 | + |
1877 | + seed_d="${rootd}/var/lib/cloud/seed/nocloud-net" |
1878 | + mkdir -p "${seed_d}" |
1879 | + |
1880 | + # fake instance-id |
1881 | + cat << EOF > "${seed_d}/meta-data" |
1882 | +instance_id: cloud-image |
1883 | +EOF |
1884 | + |
1885 | + # fake user-data to create the default user/password |
1886 | + cat << EOF > "${seed_d}/user-data" |
1887 | +#cloud-config |
1888 | +password: ubuntu |
1889 | +chpasswd: ubuntu |
1890 | +ssh_pwauth: True |
1891 | +EOF |
1892 | + |
1893 | + # tell cloud-init not to look for meta-data sources |
1894 | + cat << EOF > ${rootd}/etc/cloud/cloud.cfg.d/99-fake_cloud.cfg |
1895 | +# configure cloud-init for NoCloud |
1896 | +datasource_list: [ NoCloud, None ] |
1897 | +EOF |
1898 | +} |
1899 | + |
1900 | +## -------------- |
1901 | +# remove 127.0.1.1 entry (LP: #440757) |
1902 | +_xchroot "${rootd}" sh -c 'sed -i "/^127.0.1.1/d" /etc/hosts' |
1903 | + |
1904 | +## -------------- |
1905 | +# remove ssh pregenerated keys (LP: #512377) |
1906 | + |
1907 | +_xchroot "${rootd}" sh -c 'rm -f /etc/ssh/ssh_host_[rd]sa_key*' |
1908 | + |
1909 | +## -------------- |
1910 | +_xchroot "${rootd}" locale-gen en_US.utf8 |
1911 | + |
1912 | +## -------------- |
1913 | +# set cloud-init to be on |
1914 | +values="NoCloud, ConfigDrive, AltCloud, OVF, MAAS, Ec2, None" |
1915 | +printf "%s\t%s\t%s\t%s\n" \ |
1916 | + cloud-init cloud-init/datasources multiselect "$values" | |
1917 | + _xchroot "${rootd}" debconf-set-selections |
1918 | +_xchroot "${rootd}" dpkg-reconfigure --frontend=noninteractive cloud-init |
1919 | + |
1920 | +## -------------- |
1921 | +# write some build information to the guest |
1922 | +# the idea is that given runtime info and this info, the instance |
1923 | +# can at least determine if there is a newer build available |
1924 | +# these variables are passed in in environment from cloudimg-build-launcher |
1925 | +if [ -n "${build_name}" -o -n "${serial}" ]; then |
1926 | + d="${rootd}/etc/cloud" |
1927 | + [ -d "$d" ] || mkdir -p "${d}" |
1928 | + { |
1929 | + [ -n "${build_name}" ] && echo "build_name: ${build_name}" |
1930 | + [ -n "${serial}" ] && echo "serial: ${serial}" |
1931 | + } > "$d/build.info" |
1932 | +fi |
1933 | + |
1934 | +## -------------- |
1935 | +# for maverick and newer, use LABEL= for the '/' entry in fstab |
1936 | +if [ -n "${root_fs_label}" ]; then |
1937 | + bl="[:blank:]" |
1938 | + lstr="LABEL=${root_fs_label}" |
1939 | + sed -i "s,^[^#${bl}]*\([${bl}]*/[${bl}].*\),${lstr}\1," "${rootd}/etc/fstab" |
1940 | +fi |
1941 | +cat > /etc/fstab << EOM |
1942 | +LABEL=cloudimg-rootfs / ext4 defaults 0 0 |
1943 | +EOM |
1944 | + |
1945 | +## Make sure that the update-motd.d directory exists |
1946 | +[ ! -e "${rootd}/etc/update-motd.d" ] && |
1947 | + mkdir -p "${rootd}/etc/update-motd.d" |
1948 | + |
1949 | +## write a MOTD file advertising support for images |
1950 | +cat > "${rootd}/etc/update-motd.d/51-cloudguest" << EOF |
1951 | +#!/bin/sh |
1952 | +# |
1953 | +${CLOUD_IMG_STR} |
1954 | +# This file is not managed by a package. If you no longer want to |
1955 | +# see this message you can safely remove the file. |
1956 | +echo "" |
1957 | +echo " Get cloud support with Ubuntu Advantage Cloud Guest:" |
1958 | +echo " http://www.ubuntu.com/business/services/cloud" |
1959 | +EOF |
1960 | + |
1961 | +chmod +x "${rootd}/etc/update-motd.d/51-cloudguest" |
1962 | + |
1963 | +# for quantal and newer, add /etc/overlayroot.local.conf |
1964 | +# but do not overwrite anything that somehow got there |
1965 | +if [ -f "${rootd}/etc/overlayroot.conf" ] && |
1966 | + [ ! -f "${rootd}/etc/overlayroot.local.conf" ]; then |
1967 | + { |
1968 | + echo "${CLOUD_IMG_STR}" |
1969 | + echo "overlayroot_cfgdisk=LABEL=OROOTCFG" |
1970 | + } > "${rootd}/etc/overlayroot.local.conf" |
1971 | +fi |
1972 | + |
1973 | + |
1974 | +#### END COMMON ARCH FUNCTIONS |
1975 | + |
1976 | + |
1977 | +case $arch in |
1978 | + # ARM images are special |
1979 | + armhf|arm64) |
1980 | + echo "Configuring ARM Serial Port" |
1981 | + add_serial_console ttyAMA0 |
1982 | + # Dirty hack because SUBARCH doesn't exist when running chroot hooks, |
1983 | + # and we don't want raspi2 images to depend on a cloud data source: |
1984 | + if _xchroot "${rootd}" dpkg -l linux-image-raspi2 2>/dev/null | grep -q '^.i'; then |
1985 | + fake_cloud_init |
1986 | + fi |
1987 | + |
1988 | + echo "Image architecture is ARM. Existing vmbuilder-fixups" |
1989 | + |
1990 | + exit 0 |
1991 | + ;; |
1992 | + ## Add ttyS0 for i386/amd64 for Trusty and newer |
1993 | + i386|amd64) |
1994 | + add_serial_console ttyS0 |
1995 | + ;; |
1996 | + powerpc|ppc64el) |
1997 | + add_serial_console hvc0 |
1998 | + exit 0 |
1999 | + ;; |
2000 | +esac |
2001 | + |
2002 | +psuedo_grub_probe() { |
2003 | + cat <<"PSUEDO_GRUB_PROBE" |
2004 | +#!/bin/sh |
2005 | +Usage() { |
2006 | + cat <<EOF |
2007 | +Usage: euca-psuedo-grub-probe |
2008 | + this is a wrapper around grub-probe to provide the answers for an ec2 guest |
2009 | +EOF |
2010 | +} |
2011 | +bad_Usage() { Usage 1>&2; fail "$@"; } |
2012 | + |
2013 | +short_opts="" |
2014 | +long_opts="device-map:,target:,device" |
2015 | +getopt_out=$(getopt --name "${0##*/}" \ |
2016 | + --options "${short_opts}" --long "${long_opts}" -- "$@") && |
2017 | + eval set -- "${getopt_out}" || |
2018 | + bad_Usage |
2019 | + |
2020 | +device_map="" |
2021 | +target="" |
2022 | +device=0 |
2023 | +arg="" |
2024 | + |
2025 | +while [ $# -ne 0 ]; do |
2026 | + cur=${1}; next=${2}; |
2027 | + case "$cur" in |
2028 | + --device-map) device_map=${next}; shift;; |
2029 | + --device) device=1;; |
2030 | + --target) target=${next}; shift;; |
2031 | + --) shift; break;; |
2032 | + esac |
2033 | + shift; |
2034 | +done |
2035 | +arg=${1} |
2036 | + |
2037 | +case "${target}:${device}:${arg}" in |
2038 | + device:*:/*) echo "/dev/sda1"; exit 0;; |
2039 | + fs:*:*) echo "ext2"; exit 0;; |
2040 | + partmap:*:*) |
2041 | + # older versions of grub (lucid) want 'part_msdos' written |
2042 | + # rather than 'msdos' |
2043 | + legacy_pre="" |
2044 | + grubver=$(dpkg-query --show --showformat '${Version}\n' grub-pc 2>/dev/null) && |
2045 | + dpkg --compare-versions "${grubver}" lt 1.98+20100804-5ubuntu3 && |
2046 | + legacy_pre="part_" |
2047 | + echo "${legacy_pre}msdos"; |
2048 | + exit 0;; |
2049 | + abstraction:*:*) echo ""; exit 0;; |
2050 | + drive:*:/dev/sda) echo "(hd0)";; |
2051 | + drive:*:/dev/sda*) echo "(hd0,1)";; |
2052 | + fs_uuid:*:*) exit 1;; |
2053 | +esac |
2054 | +PSUEDO_GRUB_PROBE |
2055 | +} |
2056 | + |
2057 | +## install / setup grub2 |
2058 | +gprobe="${rootd}/usr/sbin/grub-probe" |
2059 | +moved=0 |
2060 | +if [ -f "${gprobe}" ]; then |
2061 | + mv "${gprobe}" "${gprobe}.dist" |
2062 | + moved=1 |
2063 | +fi |
2064 | +psuedo_grub_probe > "${gprobe}" |
2065 | +chmod 755 "${gprobe}" |
2066 | + |
2067 | +# for Quantal and later, use /etc/default/grub.d functionality |
2068 | +# rather than modifying the grub configuration itself. |
2069 | +# This avoids the mess of having to do dpkg stuff |
2070 | +# LP: 1179940 |
2071 | +mkdir -p "${rootd}/etc/default/grub.d" |
2072 | +cat << EOF > "${rootd}/etc/default/grub.d/50-cloudimg-settings.cfg" |
2073 | +# Cloud Image specific Grub settings for Generic Cloud Images |
2074 | +${CLOUD_IMG_STR} |
2075 | + |
2076 | +# Set the recordfail timeout |
2077 | +GRUB_RECORDFAIL_TIMEOUT=0 |
2078 | + |
2079 | +# Do not wait on grub prompt |
2080 | +GRUB_TIMEOUT=0 |
2081 | + |
2082 | +# Set the default commandline |
2083 | +GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0" |
2084 | + |
2085 | +# Set the grub console type |
2086 | +GRUB_TERMINAL=console |
2087 | +EOF |
2088 | +_xchroot "${rootd}" update-grub2 |
2089 | + |
2090 | +# since this is a disk image, we technically don't need to install all the |
2091 | +# grub modules, as the image itself is not bootable. This makes for a small |
2092 | +# disk image |
2093 | +_xchroot "${rootd}" update-grub |
2094 | + |
2095 | +# reconfigure grub so that upgrades to grub-pc do not force a debconf config |
2096 | +# changed prompt (LP: #1009294). This re-runs update-grub |
2097 | +_xchroot "${rootd}" env DEBIAN_FRONTEND=noninteractive \ |
2098 | + dpkg-reconfigure grub-pc |
2099 | + |
2100 | +grub2cfg="${rootd}/boot/grub/grub.cfg" |
2101 | +[ ! -f "${grub2cfg}" ] || |
2102 | + sed -i -e "s,root=/dev/[hs]da1,root=LABEL=${root_fs_label}," "${grub2cfg}" |
2103 | + |
2104 | +[ ${moved} -eq 0 ] || mv "${gprobe}.dist" "${gprobe}" |
2105 | + |
2106 | +## modify /boot/grub/menu.lst if it exists |
2107 | +## this is generated at install time by grub-legacy-ec2, but will have |
2108 | +## devices as found from the _xchroot. Here we write what it will be on ec2 |
2109 | +if [ -f "${rootd}/boot/grub/menu.lst" ]; then |
2110 | + grub_root="(hd0)" |
2111 | + linux_root=/dev/sda1 |
2112 | + [ -n "${root_fs_label}" ] && linux_root="LABEL=${root_fs_label}" |
2113 | + # the sed code below basically fixes/sets the following lines in a |
2114 | + # /boot/grub/menu.lst file: |
2115 | + # # kopt=root=xxxxxxx ro |
2116 | + # kernel /boot/vmlinuz-... root=xxxxxx .... |
2117 | + # # groot=xxxxx |
2118 | + # root xxxxx |
2119 | + # uuuid xxxxx |
2120 | + sed -i "${rootd}/boot/grub/menu.lst" \ |
2121 | + -e "s|^\(# kopt=root=\)[^ ]*|\1${linux_root}|" \ |
2122 | + -e "s|^\(kernel.*root=\)[^ ]*|\1${linux_root}|" \ |
2123 | + -e "s|^\(# groot=\)[^ ]*|\1${grub_root}|" \ |
2124 | + -e "s|^\(root\|uuid\)\([[:space:]]*\).*|root\2${grub_root}|" |
2125 | + |
2126 | + # grub-legacy-ec2 writes this ucf entry. since we've modified |
2127 | + # /boot/grub/menu.lst, we have to remove it, or the user will |
2128 | + # get prompted for a 3 way merge of the changes the first time this runs |
2129 | + _xchroot "${rootd}" /usr/bin/ucfr --purge grub /var/run/grub/menu.lst |
2130 | +fi |
2131 | + |
2132 | +# vi: ts=3 expandtab |
2133 | |
2134 | === added file 'live-build/ubuntu-cpc/hooks/999-extras.binary' |
2135 | --- live-build/ubuntu-cpc/hooks/999-extras.binary 1970-01-01 00:00:00 +0000 |
2136 | +++ live-build/ubuntu-cpc/hooks/999-extras.binary 2017-06-01 19:33:22 +0000 |
2137 | @@ -0,0 +1,15 @@ |
2138 | +#!/bin/bash |
2139 | +# Execute extra binary hooks. |
2140 | + |
2141 | +my_dir=$(dirname $(readlink -f ${0})) |
2142 | +extra_d=${my_dir}/extra |
2143 | + |
2144 | +if [ ! -d ${my_dir}/extra ]; then |
2145 | + exit 0 |
2146 | +fi |
2147 | + |
2148 | +# Export the common functions to the extras |
2149 | +. /build/config/functions |
2150 | + |
2151 | +# Cleaner execution |
2152 | +/bin/run-parts --regex ".*\.binary" "${extra_d}" |
2153 | |
2154 | === added file 'live-build/ubuntu-cpc/hooks/999-undivert-sync.chroot' |
2155 | --- live-build/ubuntu-cpc/hooks/999-undivert-sync.chroot 1970-01-01 00:00:00 +0000 |
2156 | +++ live-build/ubuntu-cpc/hooks/999-undivert-sync.chroot 2017-06-01 19:33:22 +0000 |
2157 | @@ -0,0 +1,5 @@ |
2158 | +#! /bin/sh |
2159 | +set -e |
2160 | + |
2161 | +rm -f /bin/sync |
2162 | +dpkg-divert --quiet --remove --rename /bin/sync |
2163 | |
2164 | === added directory 'live-build/ubuntu-cpc/hooks/ovf' |
2165 | === added file 'live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl' |
2166 | --- live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl 1970-01-01 00:00:00 +0000 |
2167 | +++ live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl 2017-06-01 19:33:22 +0000 |
2168 | @@ -0,0 +1,180 @@ |
2169 | +<?xml version="1.0" encoding="UTF-8"?> |
2170 | +<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
2171 | + <References> |
2172 | + <File ovf:href="@@FILENAME1@@" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> |
2173 | + <File ovf:href="@@FILENAME2@@" ovf:id="file2" ovf:size="@@VMDK_FILE_SIZE2@@"/> |
2174 | + </References> |
2175 | + <DiskSection> |
2176 | + <Info>Virtual disk information</Info> |
2177 | + <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0"/> |
2178 | + <Disk ovf:capacity="@@VMDK_CAPACITY2@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk2" ovf:fileRef="file2" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0"/> |
2179 | + </DiskSection> |
2180 | + <NetworkSection> |
2181 | + <Info>The list of logical networks</Info> |
2182 | + <Network ovf:name="VM Network"> |
2183 | + <Description>The VM Network network</Description> |
2184 | + </Network> |
2185 | + </NetworkSection> |
2186 | + <VirtualSystem ovf:id="@@NAME@@"> |
2187 | + <Info>A virtual machine</Info> |
2188 | + <Name>@@NAME@@</Name> |
2189 | + <OperatingSystemSection ovf:id="@@OVF_ID@@" vmw:osType="@@OVF_OS_TYPE@@"> |
2190 | + <Info>The kind of installed guest operating system</Info> |
2191 | + <Description>Ubuntu Linux (@@OVF_DESC_BITS@@-bit)</Description> |
2192 | + </OperatingSystemSection> |
2193 | + |
2194 | + <ProductSection ovf:required="false"> |
2195 | + <Info>Cloud-Init customization</Info> |
2196 | + <Product>Ubuntu @@VERSION@@ Server (@@DATE@@)</Product> |
2197 | + <Property ovf:key="instance-id" ovf:type="string" ovf:userConfigurable="true" ovf:value="id-ovf"> |
2198 | + <Label>A Unique Instance ID for this instance</Label> |
2199 | + <Description>Specifies the instance id. This is required and used to determine if the machine should take "first boot" actions</Description> |
2200 | + </Property> |
2201 | + <Property ovf:key="hostname" ovf:type="string" ovf:userConfigurable="true" ovf:value="ubuntuguest"> |
2202 | + <Description>Specifies the hostname for the appliance</Description> |
2203 | + </Property> |
2204 | + <Property ovf:key="seedfrom" ovf:type="string" ovf:userConfigurable="true"> |
2205 | + <Label>Url to seed instance data from</Label> |
2206 | + <Description>This field is optional, but indicates that the instance should 'seed' user-data and meta-data from the given url. If set to 'http://tinyurl.com/sm-' is given, meta-data will be pulled from http://tinyurl.com/sm-meta-data and user-data from http://tinyurl.com/sm-user-data. Leave this empty if you do not want to seed from a url.</Description> |
2207 | + </Property> |
2208 | + <Property ovf:key="public-keys" ovf:type="string" ovf:userConfigurable="true" ovf:value=""> |
2209 | + <Label>ssh public keys</Label> |
2210 | + <Description>This field is optional, but indicates that the instance should populate the default user's 'authorized_keys' with this value</Description> |
2211 | + </Property> |
2212 | + <Property ovf:key="user-data" ovf:type="string" ovf:userConfigurable="true" ovf:value=""> |
2213 | + <Label>Encoded user-data</Label> |
2214 | + <Description>In order to fit into a xml attribute, this value is base64 encoded . It will be decoded, and then processed normally as user-data.</Description> |
2215 | + <!-- The following represents '#!/bin/sh\necho "hi world"' |
2216 | + ovf:value="IyEvYmluL3NoCmVjaG8gImhpIHdvcmxkIgo=" |
2217 | + --> |
2218 | + </Property> |
2219 | + <Property ovf:key="password" ovf:type="string" ovf:userConfigurable="true" ovf:value=""> |
2220 | + <Label>Default User's password</Label> |
2221 | + <Description>If set, the default user's password will be set to this value to allow password based login. The password will be good for only a single login. If set to the string 'RANDOM' then a random password will be generated, and written to the console.</Description> |
2222 | + </Property> |
2223 | + </ProductSection> |
2224 | + |
2225 | + <VirtualHardwareSection ovf:transport="iso"> |
2226 | + <Info>Virtual hardware requirements</Info> |
2227 | + <System> |
2228 | + <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> |
2229 | + <vssd:InstanceID>0</vssd:InstanceID> |
2230 | + <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> |
2231 | + <vssd:VirtualSystemType>vmx-10</vssd:VirtualSystemType> |
2232 | + </System> |
2233 | + <Item> |
2234 | + <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> |
2235 | + <rasd:Description>Number of Virtual CPUs</rasd:Description> |
2236 | + <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> |
2237 | + <rasd:InstanceID>1</rasd:InstanceID> |
2238 | + <rasd:ResourceType>3</rasd:ResourceType> |
2239 | + <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> |
2240 | + </Item> |
2241 | + <Item> |
2242 | + <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> |
2243 | + <rasd:Description>Memory Size</rasd:Description> |
2244 | + <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> |
2245 | + <rasd:InstanceID>2</rasd:InstanceID> |
2246 | + <rasd:ResourceType>4</rasd:ResourceType> |
2247 | + <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> |
2248 | + </Item> |
2249 | + <Item> |
2250 | + <rasd:Address>0</rasd:Address> |
2251 | + <rasd:Description>SCSI Controller</rasd:Description> |
2252 | + <rasd:ElementName>SCSI Controller 0</rasd:ElementName> |
2253 | + <rasd:InstanceID>3</rasd:InstanceID> |
2254 | + <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> |
2255 | + <rasd:ResourceType>6</rasd:ResourceType> |
2256 | + </Item> |
2257 | + <Item> |
2258 | + <rasd:Address>1</rasd:Address> |
2259 | + <rasd:Description>IDE Controller</rasd:Description> |
2260 | + <rasd:ElementName>VirtualIDEController 1</rasd:ElementName> |
2261 | + <rasd:InstanceID>4</rasd:InstanceID> |
2262 | + <rasd:ResourceType>5</rasd:ResourceType> |
2263 | + </Item> |
2264 | + <Item> |
2265 | + <rasd:Address>0</rasd:Address> |
2266 | + <rasd:Description>IDE Controller</rasd:Description> |
2267 | + <rasd:ElementName>VirtualIDEController 0</rasd:ElementName> |
2268 | + <rasd:InstanceID>5</rasd:InstanceID> |
2269 | + <rasd:ResourceType>5</rasd:ResourceType> |
2270 | + </Item> |
2271 | + <Item ovf:required="false"> |
2272 | + <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> |
2273 | + <rasd:ElementName>VirtualVideoCard</rasd:ElementName> |
2274 | + <rasd:InstanceID>6</rasd:InstanceID> |
2275 | + <rasd:ResourceType>24</rasd:ResourceType> |
2276 | + <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> |
2277 | + <vmw:Config ovf:required="false" vmw:key="enableMPTSupport" vmw:value="false"/> |
2278 | + <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> |
2279 | + <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> |
2280 | + <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> |
2281 | + </Item> |
2282 | + <Item ovf:required="false"> |
2283 | + <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> |
2284 | + <rasd:ElementName>VirtualVMCIDevice</rasd:ElementName> |
2285 | + <rasd:InstanceID>7</rasd:InstanceID> |
2286 | + <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> |
2287 | + <rasd:ResourceType>1</rasd:ResourceType> |
2288 | + <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> |
2289 | + </Item> |
2290 | + <Item ovf:required="false"> |
2291 | + <rasd:AddressOnParent>0</rasd:AddressOnParent> |
2292 | + <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> |
2293 | + <rasd:ElementName>CD-ROM 1</rasd:ElementName> |
2294 | + <rasd:InstanceID>8</rasd:InstanceID> |
2295 | + <rasd:Parent>4</rasd:Parent> |
2296 | + <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> |
2297 | + <rasd:ResourceType>15</rasd:ResourceType> |
2298 | + <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> |
2299 | + </Item> |
2300 | + <Item> |
2301 | + <rasd:AddressOnParent>0</rasd:AddressOnParent> |
2302 | + <rasd:ElementName>Hard Disk 1</rasd:ElementName> |
2303 | + <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> |
2304 | + <rasd:InstanceID>9</rasd:InstanceID> |
2305 | + <rasd:Parent>3</rasd:Parent> |
2306 | + <rasd:ResourceType>17</rasd:ResourceType> |
2307 | + <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> |
2308 | + </Item> |
2309 | + <Item> |
2310 | + <rasd:AddressOnParent>1</rasd:AddressOnParent> |
2311 | + <rasd:ElementName>ConfigDriveDisk</rasd:ElementName> |
2312 | + <rasd:HostResource>ovf:/disk/vmdisk2</rasd:HostResource> |
2313 | + <rasd:InstanceID>10</rasd:InstanceID> |
2314 | + <rasd:Parent>3</rasd:Parent> |
2315 | + <rasd:ResourceType>17</rasd:ResourceType> |
2316 | + <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> |
2317 | + </Item> |
2318 | + <Item> |
2319 | + <rasd:AddressOnParent>7</rasd:AddressOnParent> |
2320 | + <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> |
2321 | + <rasd:Connection>VM Network</rasd:Connection> |
2322 | + <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> |
2323 | + <rasd:ElementName>Ethernet 1</rasd:ElementName> |
2324 | + <rasd:InstanceID>11</rasd:InstanceID> |
2325 | + <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> |
2326 | + <rasd:ResourceType>10</rasd:ResourceType> |
2327 | + <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> |
2328 | + </Item> |
2329 | + <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> |
2330 | + <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> |
2331 | + <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="bios"/> |
2332 | + <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> |
2333 | + <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> |
2334 | + <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> |
2335 | + <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> |
2336 | + <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="preset"/> |
2337 | + <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="preset"/> |
2338 | + <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> |
2339 | + <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="preset"/> |
2340 | + <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> |
2341 | + <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> |
2342 | + <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> |
2343 | + <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> |
2344 | + <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> |
2345 | + <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> |
2346 | + </VirtualHardwareSection> |
2347 | + </VirtualSystem> |
2348 | +</Envelope> |
2349 | |
2350 | === added file 'live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-vmdk.tmpl' |
2351 | --- live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-vmdk.tmpl 1970-01-01 00:00:00 +0000 |
2352 | +++ live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-vmdk.tmpl 2017-06-01 19:33:22 +0000 |
2353 | @@ -0,0 +1,178 @@ |
2354 | +<?xml version="1.0" encoding="UTF-8"?> |
2355 | +<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
2356 | + <References> |
2357 | + <File ovf:href="@@FILENAME@@" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/> |
2358 | + </References> |
2359 | + <DiskSection> |
2360 | + <Info>Virtual disk information</Info> |
2361 | + <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0"/> |
2362 | + </DiskSection> |
2363 | + <NetworkSection> |
2364 | + <Info>The list of logical networks</Info> |
2365 | + <Network ovf:name="VM Network"> |
2366 | + <Description>The VM Network network</Description> |
2367 | + </Network> |
2368 | + </NetworkSection> |
2369 | + <VirtualSystem ovf:id="@@NAME@@"> |
2370 | + <Info>A virtual machine</Info> |
2371 | + <Name>@@NAME@@</Name> |
2372 | + <OperatingSystemSection ovf:id="@@OVF_ID@@" vmw:osType="@@OVF_OS_TYPE@@"> |
2373 | + <Info>The kind of installed guest operating system</Info> |
2374 | + <Description>Ubuntu Linux (@@OVF_DESC_BITS@@-bit)</Description> |
2375 | + </OperatingSystemSection> |
2376 | + |
2377 | + <ProductSection ovf:required="false"> |
2378 | + <Info>Cloud-Init customization</Info> |
2379 | + <Product>Ubuntu @@VERSION@@ Server (@@DATE@@)</Product> |
2380 | + <Property ovf:key="instance-id" ovf:type="string" ovf:userConfigurable="true" ovf:value="id-ovf"> |
2381 | + <Label>A Unique Instance ID for this instance</Label> |
2382 | + <Description>Specifies the instance id. This is required and used to determine if the machine should take "first boot" actions</Description> |
2383 | + </Property> |
2384 | + <Property ovf:key="hostname" ovf:type="string" ovf:userConfigurable="true" ovf:value="ubuntuguest"> |
2385 | + <Description>Specifies the hostname for the appliance</Description> |
2386 | + </Property> |
2387 | + <Property ovf:key="seedfrom" ovf:type="string" ovf:userConfigurable="true"> |
2388 | + <Label>Url to seed instance data from</Label> |
2389 | + <Description>This field is optional, but indicates that the instance should 'seed' user-data and meta-data from the given url. If set to 'http://tinyurl.com/sm-' is given, meta-data will be pulled from http://tinyurl.com/sm-meta-data and user-data from http://tinyurl.com/sm-user-data. Leave this empty if you do not want to seed from a url.</Description> |
2390 | + </Property> |
2391 | + <Property ovf:key="public-keys" ovf:type="string" ovf:userConfigurable="true" ovf:value=""> |
2392 | + <Label>ssh public keys</Label> |
2393 | + <Description>This field is optional, but indicates that the instance should populate the default user's 'authorized_keys' with this value</Description> |
2394 | + </Property> |
2395 | + <Property ovf:key="user-data" ovf:type="string" ovf:userConfigurable="true" ovf:value=""> |
2396 | + <Label>Encoded user-data</Label> |
2397 | + <Description>In order to fit into a xml attribute, this value is base64 encoded . It will be decoded, and then processed normally as user-data.</Description> |
2398 | + <!-- The following represents '#!/bin/sh\necho "hi world"' |
2399 | + ovf:value="IyEvYmluL3NoCmVjaG8gImhpIHdvcmxkIgo=" |
2400 | + --> |
2401 | + </Property> |
2402 | + <Property ovf:key="password" ovf:type="string" ovf:userConfigurable="true" ovf:value=""> |
2403 | + <Label>Default User's password</Label> |
2404 | + <Description>If set, the default user's password will be set to this value to allow password based login. The password will be good for only a single login. If set to the string 'RANDOM' then a random password will be generated, and written to the console.</Description> |
2405 | + </Property> |
2406 | + </ProductSection> |
2407 | + |
2408 | + <VirtualHardwareSection ovf:transport="iso"> |
2409 | + <Info>Virtual hardware requirements</Info> |
2410 | + <System> |
2411 | + <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> |
2412 | + <vssd:InstanceID>0</vssd:InstanceID> |
2413 | + <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier> |
2414 | + <vssd:VirtualSystemType>vmx-10</vssd:VirtualSystemType> |
2415 | + </System> |
2416 | + <Item> |
2417 | + <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> |
2418 | + <rasd:Description>Number of Virtual CPUs</rasd:Description> |
2419 | + <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName> |
2420 | + <rasd:InstanceID>1</rasd:InstanceID> |
2421 | + <rasd:ResourceType>3</rasd:ResourceType> |
2422 | + <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity> |
2423 | + </Item> |
2424 | + <Item> |
2425 | + <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> |
2426 | + <rasd:Description>Memory Size</rasd:Description> |
2427 | + <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName> |
2428 | + <rasd:InstanceID>2</rasd:InstanceID> |
2429 | + <rasd:ResourceType>4</rasd:ResourceType> |
2430 | + <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity> |
2431 | + </Item> |
2432 | + <Item> |
2433 | + <rasd:Address>0</rasd:Address> |
2434 | + <rasd:Description>SCSI Controller</rasd:Description> |
2435 | + <rasd:ElementName>SCSI Controller 0</rasd:ElementName> |
2436 | + <rasd:InstanceID>3</rasd:InstanceID> |
2437 | + <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType> |
2438 | + <rasd:ResourceType>6</rasd:ResourceType> |
2439 | + </Item> |
2440 | + <Item> |
2441 | + <rasd:Address>1</rasd:Address> |
2442 | + <rasd:Description>IDE Controller</rasd:Description> |
2443 | + <rasd:ElementName>VirtualIDEController 1</rasd:ElementName> |
2444 | + <rasd:InstanceID>4</rasd:InstanceID> |
2445 | + <rasd:ResourceType>5</rasd:ResourceType> |
2446 | + </Item> |
2447 | + <Item> |
2448 | + <rasd:Address>0</rasd:Address> |
2449 | + <rasd:Description>IDE Controller</rasd:Description> |
2450 | + <rasd:ElementName>VirtualIDEController 0</rasd:ElementName> |
2451 | + <rasd:InstanceID>5</rasd:InstanceID> |
2452 | + <rasd:ResourceType>5</rasd:ResourceType> |
2453 | + </Item> |
2454 | + <Item ovf:required="false"> |
2455 | + <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> |
2456 | + <rasd:ElementName>VirtualVideoCard</rasd:ElementName> |
2457 | + <rasd:InstanceID>6</rasd:InstanceID> |
2458 | + <rasd:ResourceType>24</rasd:ResourceType> |
2459 | + <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/> |
2460 | + <vmw:Config ovf:required="false" vmw:key="enableMPTSupport" vmw:value="false"/> |
2461 | + <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/> |
2462 | + <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/> |
2463 | + <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/> |
2464 | + </Item> |
2465 | + <Item ovf:required="false"> |
2466 | + <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> |
2467 | + <rasd:ElementName>VirtualVMCIDevice</rasd:ElementName> |
2468 | + <rasd:InstanceID>7</rasd:InstanceID> |
2469 | + <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType> |
2470 | + <rasd:ResourceType>1</rasd:ResourceType> |
2471 | + <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/> |
2472 | + </Item> |
2473 | + <Item ovf:required="false"> |
2474 | + <rasd:AddressOnParent>0</rasd:AddressOnParent> |
2475 | + <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> |
2476 | + <rasd:ElementName>CD-ROM 1</rasd:ElementName> |
2477 | + <rasd:InstanceID>8</rasd:InstanceID> |
2478 | + <rasd:Parent>4</rasd:Parent> |
2479 | + <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType> |
2480 | + <rasd:ResourceType>15</rasd:ResourceType> |
2481 | + <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/> |
2482 | + </Item> |
2483 | + <Item> |
2484 | + <rasd:AddressOnParent>0</rasd:AddressOnParent> |
2485 | + <rasd:ElementName>Hard Disk 1</rasd:ElementName> |
2486 | + <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> |
2487 | + <rasd:InstanceID>9</rasd:InstanceID> |
2488 | + <rasd:Parent>3</rasd:Parent> |
2489 | + <rasd:ResourceType>17</rasd:ResourceType> |
2490 | + <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/> |
2491 | + </Item> |
2492 | + <Item ovf:required="false"> |
2493 | + <rasd:AddressOnParent>0</rasd:AddressOnParent> |
2494 | + <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> |
2495 | + <rasd:Description>Floppy Drive</rasd:Description> |
2496 | + <rasd:ElementName>Floppy 1</rasd:ElementName> |
2497 | + <rasd:InstanceID>10</rasd:InstanceID> |
2498 | + <rasd:ResourceSubType>vmware.floppy.remotedevice</rasd:ResourceSubType> |
2499 | + <rasd:ResourceType>14</rasd:ResourceType> |
2500 | + </Item> |
2501 | + <Item> |
2502 | + <rasd:AddressOnParent>7</rasd:AddressOnParent> |
2503 | + <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> |
2504 | + <rasd:Connection>VM Network</rasd:Connection> |
2505 | + <rasd:Description>VmxNet3 ethernet adapter on "VM Network"</rasd:Description> |
2506 | + <rasd:ElementName>Ethernet 1</rasd:ElementName> |
2507 | + <rasd:InstanceID>11</rasd:InstanceID> |
2508 | + <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType> |
2509 | + <rasd:ResourceType>10</rasd:ResourceType> |
2510 | + <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/> |
2511 | + </Item> |
2512 | + <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/> |
2513 | + <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/> |
2514 | + <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="bios"/> |
2515 | + <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/> |
2516 | + <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/> |
2517 | + <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/> |
2518 | + <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/> |
2519 | + <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="preset"/> |
2520 | + <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="preset"/> |
2521 | + <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/> |
2522 | + <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="preset"/> |
2523 | + <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/> |
2524 | + <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/> |
2525 | + <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/> |
2526 | + <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/> |
2527 | + <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/> |
2528 | + <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/> |
2529 | + </VirtualHardwareSection> |
2530 | + </VirtualSystem> |
2531 | +</Envelope> |
2532 | |
2533 | === added file 'live-build/ubuntu-cpc/hooks/ovf/ubuntu-ovf-v1-img.tmpl' |
2534 | --- live-build/ubuntu-cpc/hooks/ovf/ubuntu-ovf-v1-img.tmpl 1970-01-01 00:00:00 +0000 |
2535 | +++ live-build/ubuntu-cpc/hooks/ovf/ubuntu-ovf-v1-img.tmpl 2017-06-01 19:33:22 +0000 |
2536 | @@ -0,0 +1,130 @@ |
2537 | +<?xml version="1.0" encoding="UTF-8"?> |
2538 | +<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
2539 | + <References> |
2540 | + <File ovf:href="$FILE_DISK_HREF" ovf:id="file1" ovf:size="$FILE_DISK_SIZE" /> |
2541 | + </References> |
2542 | + <DiskSection> |
2543 | + <Info>Virtual disk information</Info> |
2544 | + <Disk ovf:capacity="$DISK_CAPACITY" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://wiki.qemu.org/download/qcow2-spec.html"/> |
2545 | + </DiskSection> |
2546 | + <NetworkSection> |
2547 | + <Info>The list of logical networks</Info> |
2548 | + <Network ovf:name="bridged"> |
2549 | + <Description>The bridged network</Description> |
2550 | + </Network> |
2551 | + </NetworkSection> |
2552 | + <VirtualSystem ovf:id="vm"> |
2553 | + <Info>A virtual machine</Info> |
2554 | + <Name>$VIRTUAL_SYSTEM_NAME</Name> |
2555 | + <OperatingSystemSection ovf:id="93"> |
2556 | + <Info>$VIRTUAL_SYSTEM_OS_INFO</Info> |
2557 | + </OperatingSystemSection> |
2558 | + <ProductSection> |
2559 | + <Info>Cloud-Init customization</Info> |
2560 | + <Product>$VIRTUAL_SYSTEM_OS_INFO</Product> |
2561 | + <Property ovf:key="instance-id" ovf:type="string" ovf:userConfigurable="true" ovf:value="id-ovf"> |
2562 | + <Label>A Unique Instance ID for this instance</Label> |
2563 | + <Description>Specifies the instance id. This is required and used to determine if the machine should take "first boot" actions</Description> |
2564 | + </Property> |
2565 | + <Property ovf:key="hostname" ovf:type="string" ovf:userConfigurable="true" ovf:value="ubuntuguest"> |
2566 | + <Description>Specifies the hostname for the appliance</Description> |
2567 | + </Property> |
2568 | + <Property ovf:key="seedfrom" ovf:type="string" ovf:userConfigurable="true"> |
2569 | + <Label>Url to seed instance data from</Label> |
2570 | + <Description>This field is optional, but indicates that the instance should 'seed' user-data and meta-data from the given url. If set to 'http://tinyurl.com/sm-' is given, meta-data will be pulled from http://tinyurl.com/sm-meta-data and user-data from http://tinyurl.com/sm-user-data. Leave this empty if you do not want to seed from a url.</Description> |
2571 | + </Property> |
2572 | + <Property ovf:key="public-keys" ovf:type="string" ovf:userConfigurable="true" ovf:value=""> |
2573 | + <Label>ssh public keys</Label> |
2574 | + <Description>This field is optional, but indicates that the instance should populate the default user's 'authorized_keys' with this value</Description> |
2575 | + </Property> |
2576 | + <Property ovf:key="user-data" ovf:type="string" ovf:userConfigurable="true" ovf:value=""> |
2577 | + <Label>Encoded user-data</Label> |
2578 | + <Description>In order to fit into a xml attribute, this value is base64 encoded . It will be decoded, and then processed normally as user-data.</Description> |
2579 | + <!-- The following represents '#!/bin/sh\necho "hi world"' |
2580 | + ovf:value="IyEvYmluL3NoCmVjaG8gImhpIHdvcmxkIgo=" |
2581 | + --> |
2582 | + </Property> |
2583 | + <Property ovf:key="password" ovf:type="string" ovf:userConfigurable="true" ovf:value=""> |
2584 | + <Label>Default User's password</Label> |
2585 | + <Description>If set, the default user's password will be set to this value to allow password based login. The password will be good for only a single login. If set to the string 'RANDOM' then a random password will be generated, and written to the console.</Description> |
2586 | + </Property> |
2587 | + </ProductSection> |
2588 | + <VirtualHardwareSection ovf:transport="iso"> |
2589 | + <Info>Virtual hardware requirements</Info> |
2590 | + <System> |
2591 | + <vssd:ElementName>Virtual Hardware Family</vssd:ElementName> |
2592 | + <vssd:InstanceID>0</vssd:InstanceID> |
2593 | + <vssd:VirtualSystemIdentifier>$VIRTUAL_SYSTEM_IDENTIFIER</vssd:VirtualSystemIdentifier> |
2594 | + <vssd:VirtualSystemType>$VIRTUAL_SYSTEM_TYPES</vssd:VirtualSystemType> |
2595 | + </System> |
2596 | + <Item> |
2597 | + <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits> |
2598 | + <rasd:Description>Number of Virtual CPUs</rasd:Description> |
2599 | + <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName> |
2600 | + <rasd:InstanceID>1</rasd:InstanceID> |
2601 | + <rasd:ResourceType>3</rasd:ResourceType> |
2602 | + <rasd:VirtualQuantity>1</rasd:VirtualQuantity> |
2603 | + </Item> |
2604 | + <Item> |
2605 | + <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> |
2606 | + <rasd:Description>Memory Size</rasd:Description> |
2607 | + <rasd:ElementName>256MB of memory</rasd:ElementName> |
2608 | + <rasd:InstanceID>2</rasd:InstanceID> |
2609 | + <rasd:ResourceType>4</rasd:ResourceType> |
2610 | + <rasd:VirtualQuantity>256</rasd:VirtualQuantity> |
2611 | + </Item> |
2612 | + <Item ovf:required="false"> |
2613 | + <rasd:Address>0</rasd:Address> |
2614 | + <rasd:Description>USB Controller</rasd:Description> |
2615 | + <rasd:ElementName>usb</rasd:ElementName> |
2616 | + <rasd:InstanceID>3</rasd:InstanceID> |
2617 | + <rasd:ResourceType>23</rasd:ResourceType> |
2618 | + </Item> |
2619 | + <Item> |
2620 | + <rasd:Address>0</rasd:Address> |
2621 | + <rasd:Description>SCSI Controller</rasd:Description> |
2622 | + <rasd:ElementName>scsiController0</rasd:ElementName> |
2623 | + <rasd:InstanceID>4</rasd:InstanceID> |
2624 | + <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType> |
2625 | + <rasd:ResourceType>6</rasd:ResourceType> |
2626 | + </Item> |
2627 | + <Item> |
2628 | + <rasd:Address>1</rasd:Address> |
2629 | + <rasd:Description>IDE Controller</rasd:Description> |
2630 | + <rasd:ElementName>ideController1</rasd:ElementName> |
2631 | + <rasd:InstanceID>5</rasd:InstanceID> |
2632 | + <rasd:ResourceType>5</rasd:ResourceType> |
2633 | + </Item> |
2634 | + <Item ovf:required="false"> |
2635 | + <rasd:AddressOnParent>0</rasd:AddressOnParent> |
2636 | + <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation> |
2637 | + <rasd:ElementName>cdrom1</rasd:ElementName> |
2638 | + <rasd:InstanceID>6</rasd:InstanceID> |
2639 | + <rasd:Parent>5</rasd:Parent> |
2640 | + <rasd:ResourceType>15</rasd:ResourceType> |
2641 | + </Item> |
2642 | + <Item> |
2643 | + <rasd:AddressOnParent>0</rasd:AddressOnParent> |
2644 | + <rasd:ElementName>disk1</rasd:ElementName> |
2645 | + <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource> |
2646 | + <rasd:InstanceID>7</rasd:InstanceID> |
2647 | + <rasd:Parent>4</rasd:Parent> |
2648 | + <rasd:ResourceType>17</rasd:ResourceType> |
2649 | + </Item> |
2650 | + <Item> |
2651 | + <rasd:AddressOnParent>2</rasd:AddressOnParent> |
2652 | + <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> |
2653 | + <rasd:Connection>bridged</rasd:Connection> |
2654 | + <rasd:Description>ethernet adapter on "bridged"</rasd:Description> |
2655 | + <rasd:ElementName>ethernet0</rasd:ElementName> |
2656 | + <rasd:InstanceID>8</rasd:InstanceID> |
2657 | + <rasd:ResourceSubType>E1000</rasd:ResourceSubType> |
2658 | + <rasd:ResourceType>10</rasd:ResourceType> |
2659 | + </Item> |
2660 | + </VirtualHardwareSection> |
2661 | + <AnnotationSection ovf:required="false"> |
2662 | + <Info>$ANNOTATION_INFO</Info> |
2663 | + <Annotation>$ANNOTATION</Annotation> |
2664 | + </AnnotationSection> |
2665 | + </VirtualSystem> |
2666 | +</Envelope> |
2667 | |
2668 | === added directory 'live-build/ubuntu-cpc/hooks/raspi2' |
2669 | === added file 'live-build/ubuntu-cpc/hooks/raspi2/mkknlimg' |
2670 | --- live-build/ubuntu-cpc/hooks/raspi2/mkknlimg 1970-01-01 00:00:00 +0000 |
2671 | +++ live-build/ubuntu-cpc/hooks/raspi2/mkknlimg 2017-06-01 19:33:22 +0000 |
2672 | @@ -0,0 +1,244 @@ |
2673 | +#!/usr/bin/env perl |
2674 | +# ---------------------------------------------------------------------- |
2675 | +# mkknlimg by Phil Elwell for Raspberry Pi |
2676 | +# based on extract-ikconfig by Dick Streefland |
2677 | +# |
2678 | +# (c) 2009,2010 Dick Streefland <dick@streefland.net> |
2679 | +# (c) 2014,2015 Raspberry Pi (Trading) Limited <info@raspberrypi.org> |
2680 | +# |
2681 | +# Licensed under the terms of the GNU General Public License. |
2682 | +# ---------------------------------------------------------------------- |
2683 | + |
2684 | +use strict; |
2685 | +use warnings; |
2686 | +use integer; |
2687 | + |
2688 | +my $trailer_magic = 'RPTL'; |
2689 | + |
2690 | +my $tmpfile1 = "/tmp/mkknlimg_$$.1"; |
2691 | +my $tmpfile2 = "/tmp/mkknlimg_$$.2"; |
2692 | + |
2693 | +my $dtok = 0; |
2694 | +my $is_283x = 0; |
2695 | + |
2696 | +while (@ARGV && ($ARGV[0] =~ /^-/)) |
2697 | +{ |
2698 | + my $arg = shift(@ARGV); |
2699 | + if ($arg eq '--dtok') |
2700 | + { |
2701 | + $dtok = 1; |
2702 | + } |
2703 | + elsif ($arg eq '--283x') |
2704 | + { |
2705 | + $is_283x = 1; |
2706 | + } |
2707 | + else |
2708 | + { |
2709 | + print ("* Unknown option '$arg'\n"); |
2710 | + usage(); |
2711 | + } |
2712 | +} |
2713 | + |
2714 | +usage() if (@ARGV != 2); |
2715 | + |
2716 | +my $kernel_file = $ARGV[0]; |
2717 | +my $out_file = $ARGV[1]; |
2718 | + |
2719 | +if (! -r $kernel_file) |
2720 | +{ |
2721 | + print ("* File '$kernel_file' not found\n"); |
2722 | + usage(); |
2723 | +} |
2724 | + |
2725 | +my @wanted_strings = |
2726 | +( |
2727 | + 'bcm2708_fb', |
2728 | + 'brcm,bcm2835-mmc', |
2729 | + 'brcm,bcm2835-sdhost', |
2730 | + 'brcm,bcm2708-pinctrl', |
2731 | + 'brcm,bcm2835-gpio', |
2732 | + 'brcm,bcm2835', |
2733 | + 'brcm,bcm2836' |
2734 | +); |
2735 | + |
2736 | +my $res = try_extract($kernel_file, $tmpfile1); |
2737 | +$res = try_decompress('\037\213\010', 'xy', 'gunzip', 0, |
2738 | + $kernel_file, $tmpfile1, $tmpfile2) if (!$res); |
2739 | +$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, |
2740 | + $kernel_file, $tmpfile1, $tmpfile2) if (!$res); |
2741 | +$res = try_decompress('BZh', 'xy', 'bunzip2', 0, |
2742 | + $kernel_file, $tmpfile1, $tmpfile2) if (!$res); |
2743 | +$res = try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, |
2744 | + $kernel_file, $tmpfile1, $tmpfile2) if (!$res); |
2745 | +$res = try_decompress('\211\114\132', 'xy', 'lzop -d', 0, |
2746 | + $kernel_file, $tmpfile1, $tmpfile2) if (!$res); |
2747 | +$res = try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, |
2748 | + $kernel_file, $tmpfile1, $tmpfile2) if (!$res); |
2749 | + |
2750 | +my $append_trailer; |
2751 | +my $trailer; |
2752 | +my $kver = '?'; |
2753 | + |
2754 | +$append_trailer = $dtok; |
2755 | + |
2756 | +if ($res) |
2757 | +{ |
2758 | + $kver = $res->{''} || '?'; |
2759 | + print("Version: $kver\n"); |
2760 | + |
2761 | + $append_trailer = $dtok; |
2762 | + if (!$dtok) |
2763 | + { |
2764 | + if (config_bool($res, 'bcm2708_fb') || |
2765 | + config_bool($res, 'brcm,bcm2835-mmc') || |
2766 | + config_bool($res, 'brcm,bcm2835-sdhost')) |
2767 | + { |
2768 | + $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); |
2769 | + $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); |
2770 | + $is_283x ||= config_bool($res, 'brcm,bcm2835'); |
2771 | + $is_283x ||= config_bool($res, 'brcm,bcm2836'); |
2772 | + $dtok ||= $is_283x; |
2773 | + $append_trailer = 1; |
2774 | + } |
2775 | + else |
2776 | + { |
2777 | + print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); |
2778 | + } |
2779 | + } |
2780 | +} |
2781 | +elsif (!$dtok) |
2782 | +{ |
2783 | + print ("* Is this a valid kernel? In pass-through mode.\n"); |
2784 | +} |
2785 | + |
2786 | +if ($append_trailer) |
2787 | +{ |
2788 | + printf("DT: %s\n", $dtok ? "y" : "n"); |
2789 | + printf("283x: %s\n", $is_283x ? "y" : "n"); |
2790 | + |
2791 | + my @atoms; |
2792 | + |
2793 | + push @atoms, [ $trailer_magic, pack('V', 0) ]; |
2794 | + push @atoms, [ 'KVer', $kver ]; |
2795 | + push @atoms, [ 'DTOK', pack('V', $dtok) ]; |
2796 | + push @atoms, [ '283x', pack('V', $is_283x) ]; |
2797 | + |
2798 | + $trailer = pack_trailer(\@atoms); |
2799 | + $atoms[0]->[1] = pack('V', length($trailer)); |
2800 | + |
2801 | + $trailer = pack_trailer(\@atoms); |
2802 | +} |
2803 | + |
2804 | +my $ofh; |
2805 | +my $total_len = 0; |
2806 | + |
2807 | +if ($out_file eq $kernel_file) |
2808 | +{ |
2809 | + die "* Failed to open '$out_file' for append\n" |
2810 | + if (!open($ofh, '>>', $out_file)); |
2811 | + $total_len = tell($ofh); |
2812 | +} |
2813 | +else |
2814 | +{ |
2815 | + die "* Failed to open '$kernel_file'\n" |
2816 | + if (!open(my $ifh, '<', $kernel_file)); |
2817 | + die "* Failed to create '$out_file'\n" |
2818 | + if (!open($ofh, '>', $out_file)); |
2819 | + |
2820 | + my $copybuf; |
2821 | + while (1) |
2822 | + { |
2823 | + my $bytes = sysread($ifh, $copybuf, 64*1024); |
2824 | + last if (!$bytes); |
2825 | + syswrite($ofh, $copybuf, $bytes); |
2826 | + $total_len += $bytes; |
2827 | + } |
2828 | + close($ifh); |
2829 | +} |
2830 | + |
2831 | +if ($trailer) |
2832 | +{ |
2833 | + # Pad to word-alignment |
2834 | + syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3)); |
2835 | + syswrite($ofh, $trailer); |
2836 | +} |
2837 | + |
2838 | +close($ofh); |
2839 | + |
2840 | +exit($trailer ? 0 : 1); |
2841 | + |
2842 | +END { |
2843 | + unlink($tmpfile1) if ($tmpfile1); |
2844 | + unlink($tmpfile2) if ($tmpfile2); |
2845 | +} |
2846 | + |
2847 | + |
2848 | +sub usage |
2849 | +{ |
2850 | + print ("Usage: mkknlimg [--dtok] [--283x] <vmlinux|zImage|bzImage> <outfile>\n"); |
2851 | + exit(1); |
2852 | +} |
2853 | + |
2854 | +sub try_extract |
2855 | +{ |
2856 | + my ($knl, $tmp) = @_; |
2857 | + |
2858 | + my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`; |
2859 | + |
2860 | + return undef if (!$ver); |
2861 | + |
2862 | + chomp($ver); |
2863 | + |
2864 | + my $res = { ''=>$ver }; |
2865 | + my $string_pattern = '^('.join('|', @wanted_strings).')$'; |
2866 | + |
2867 | + my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; |
2868 | + foreach my $match (@matches) |
2869 | + { |
2870 | + chomp($match); |
2871 | + $res->{$match} = 1; |
2872 | + } |
2873 | + |
2874 | + return $res; |
2875 | +} |
2876 | + |
2877 | + |
2878 | +sub try_decompress |
2879 | +{ |
2880 | + my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_; |
2881 | + |
2882 | + my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`; |
2883 | + if ($pos) |
2884 | + { |
2885 | + chomp($pos); |
2886 | + $pos = (split(/[\r\n]+/, $pos))[$idx]; |
2887 | + return undef if (!defined($pos)); |
2888 | + $pos =~ s/:.*[\r\n]*$//s; |
2889 | + my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null"; |
2890 | + my $err = (system($cmd) >> 8); |
2891 | + return undef if (($err != 0) && ($err != 2)); |
2892 | + |
2893 | + return try_extract($tmp2, $tmp1); |
2894 | + } |
2895 | + |
2896 | + return undef; |
2897 | +} |
2898 | + |
2899 | +sub pack_trailer |
2900 | +{ |
2901 | + my ($atoms) = @_; |
2902 | + my $trailer = pack('VV', 0, 0); |
2903 | + for (my $i = $#$atoms; $i>=0; $i--) |
2904 | + { |
2905 | + my $atom = $atoms->[$i]; |
2906 | + $trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]); |
2907 | + } |
2908 | + return $trailer; |
2909 | +} |
2910 | + |
2911 | +sub config_bool |
2912 | +{ |
2913 | + my ($configs, $wanted) = @_; |
2914 | + my $val = $configs->{$wanted} || 'n'; |
2915 | + return (($val eq 'y') || ($val eq '1')); |
2916 | +} |
2917 | |
2918 | === added directory 'live-build/ubuntu-cpc/includes.chroot' |
2919 | === added directory 'live-build/ubuntu-cpc/includes.chroot/etc' |
2920 | === added file 'live-build/ubuntu-cpc/includes.chroot/etc/hostname' |
2921 | --- live-build/ubuntu-cpc/includes.chroot/etc/hostname 1970-01-01 00:00:00 +0000 |
2922 | +++ live-build/ubuntu-cpc/includes.chroot/etc/hostname 2017-06-01 19:33:22 +0000 |
2923 | @@ -0,0 +1,1 @@ |
2924 | +ubuntu |
2925 | |
2926 | === added file 'live-build/ubuntu-cpc/includes.chroot/etc/hosts' |
2927 | --- live-build/ubuntu-cpc/includes.chroot/etc/hosts 1970-01-01 00:00:00 +0000 |
2928 | +++ live-build/ubuntu-cpc/includes.chroot/etc/hosts 2017-06-01 19:33:22 +0000 |
2929 | @@ -0,0 +1,9 @@ |
2930 | +127.0.0.1 localhost |
2931 | + |
2932 | +# The following lines are desirable for IPv6 capable hosts |
2933 | +::1 ip6-localhost ip6-loopback |
2934 | +fe00::0 ip6-localnet |
2935 | +ff00::0 ip6-mcastprefix |
2936 | +ff02::1 ip6-allnodes |
2937 | +ff02::2 ip6-allrouters |
2938 | +ff02::3 ip6-allhosts |
2939 | |
2940 | === added directory 'live-build/ubuntu-cpc/includes.chroot/etc/network' |
2941 | === added file 'live-build/ubuntu-cpc/includes.chroot/etc/network/interfaces' |
2942 | --- live-build/ubuntu-cpc/includes.chroot/etc/network/interfaces 1970-01-01 00:00:00 +0000 |
2943 | +++ live-build/ubuntu-cpc/includes.chroot/etc/network/interfaces 2017-06-01 19:33:22 +0000 |
2944 | @@ -0,0 +1,15 @@ |
2945 | +# This file describes the network interfaces available on your system |
2946 | +# and how to activate them. For more information, see interfaces(5). |
2947 | + |
2948 | +# The loopback network interface |
2949 | +auto lo |
2950 | +iface lo inet loopback |
2951 | + |
2952 | +# Source interfaces |
2953 | +# Please check /etc/network/interfaces.d before changing this file |
2954 | +# as interfaces may have been defined in /etc/network/interfaces.d |
2955 | +# NOTE: the primary ethernet device is defined in |
2956 | +# /etc/network/interfaces.d/eth0 |
2957 | +# See LP: #1262951 |
2958 | +source /etc/network/interfaces.d/*.cfg |
2959 | + |
2960 | |
2961 | === added directory 'live-build/ubuntu-cpc/includes.chroot/etc/network/interfaces.d' |
2962 | === added file 'live-build/ubuntu-cpc/includes.chroot/etc/network/interfaces.d/eth0.cfg' |
2963 | --- live-build/ubuntu-cpc/includes.chroot/etc/network/interfaces.d/eth0.cfg 1970-01-01 00:00:00 +0000 |
2964 | +++ live-build/ubuntu-cpc/includes.chroot/etc/network/interfaces.d/eth0.cfg 2017-06-01 19:33:22 +0000 |
2965 | @@ -0,0 +1,3 @@ |
2966 | +# The primary network interface |
2967 | +auto eth0 |
2968 | +iface eth0 inet dhcp |
This depends on https:/ /code.launchpad .net/~rcj/ ubuntu/ +source/ live-build/ +git/live- build/+ ref/feature/ support_ livecd- rootfs_ ubuntu- cpc commits. There's no tree for trusty live-build so I made use of the usd-import-team tree.