5 # Copyright 2017 Red Hat Inc.
8 # Fam Zheng <famz@redhat.com>
10 # This code is licensed under the GPL version 2 or later. See
11 # the COPYING file in the top-level directory.
20 class UbuntuX86VM(basevm.BaseVM):
26 sudo chmod a+r /dev/vdb;
28 ./configure {configure_opts};
29 make --output-sync {target} -j{jobs} {verbose};
32 def build_image(self, img):
33 cimg = self._download_with_cache(
34 "https://cloud-images.ubuntu.com/releases/bionic/release-20191114/ubuntu-18.04-server-cloudimg-i386.img",
35 sha256sum="28969840626d1ea80bb249c08eef1a4533e8904aa51a327b40f37ac4b4ff04ef")
36 img_tmp = img + ".tmp"
37 subprocess.check_call(["cp", "-f", cimg, img_tmp])
38 self.exec_qemu_img("resize", img_tmp, "50G")
39 self.boot(img_tmp, extra_args = [
41 "-cdrom", self.gen_cloud_init_iso()
44 self.ssh_root_check("touch /etc/cloud/cloud-init.disabled")
45 self.ssh_root_check("apt-get update")
46 self.ssh_root_check("apt-get install -y cloud-initramfs-growroot")
47 # Don't check the status in case the guest hang up too quickly
48 self.ssh_root("sync && reboot")
51 # The previous update sometimes doesn't survive a reboot, so do it again
52 self.ssh_root_check("sed -ie s/^#\ deb-src/deb-src/g /etc/apt/sources.list")
53 self.ssh_root_check("apt-get update")
54 self.ssh_root_check("apt-get build-dep -y qemu")
55 self.ssh_root_check("apt-get install -y libfdt-dev flex bison language-pack-en")
56 self.ssh_root("poweroff")
58 os.rename(img_tmp, img)
61 if __name__ == "__main__":
62 sys.exit(basevm.main(UbuntuX86VM))