Skip to contentSkip to conversation

Debian preseed support

PATCH New Lucas Meneghel Rodrigues 1 participant 3 messages Oct 10, 2011 KVM

lore
Share & tools
lore
#0 lore raw

cover Debian preseed support

This patchset adds support to debian preseed files

http://wiki.debian.org/DebianInstaller/Preseed

Comes with Ubuntu server 11.04 support. Later, more patches adding Debian and other Ubuntu server variants will be added.

This patchset was also sent as a pull request

https://github.com/autotest/autotest/pull/34

Please review and comment.

Lucas Meneghel Rodrigues (2):
KVM test: Introduce debian preseed unattended file support KVM test: guest-os.cfg: Introduce Ubuntu 11.04 server variant

 client/tests/kvm/guest-os.cfg.sample             |   34 ++++++++++++++----
 client/tests/kvm/tests/unattended_install.py     |   31 ++++++++++++++++
 client/tests/kvm/unattended/Ubuntu-11-04.preseed |   42 ++++++++++++++++++++++
 3 files changed, 100 insertions(+), 7 deletions(-)
 create mode 100644 client/tests/kvm/unattended/Ubuntu-11-04.preseed
Signature · 1 line
1.7.6.4
#1 lore raw

PATCH 1/2 KVM test: Introduce debian preseed unattended file support

Add support to debian preseed

http://wiki.debian.org/DebianInstaller/Preseed

unattended install file format. In order to get fully automated d-i automation, we are using initrd preseed method (add a preseed.cfg file on top of the initrd filesystem). Tested with Ubuntu server 11.04, will add other debian and debian based OS variants on later patches.

---
 client/tests/kvm/tests/unattended_install.py |   31 ++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
client/tests/kvm/tests/unattended_install.py +31 -0
index b1d23f6..f3f5268 100644
@@ -407,6 +407,34 @@ class UnattendedInstallConfig(object):
         doc.writexml(fp)
 
 
+    def preseed_initrd(self):
+        """
+        Puts a preseed file inside a gz compressed initrd file.
+
+        Debian and Ubuntu use preseed as the OEM install mechanism. The only
+        way to get fully automated setup without resorting to kernel params
+        is to add a preseed.cfg file at the root of the initrd image.
+        """
+        logging.debug("Remastering initrd.gz file with preseed file")
+        dest_fname = 'preseed.cfg'
+        remaster_path = os.path.join(self.image_path, "initrd_remaster")
+        os.makedirs(remaster_path)
+
+        os.chdir(remaster_path)
+        utils.run("gzip -d < ../%s | cpio --extract --make-directories "
+                  "--no-absolute-filenames" % os.path.basename(self.initrd))
+        utils.run("cp %s %s" % (self.unattended_file, dest_fname))
+        utils.run("find . | cpio -H newc --create | gzip -9 > ../%s" %
+                  os.path.basename(self.initrd))
+        os.chdir(self.image_path)
+        utils.run("rm -rf initrd_remaster")
+        contents = open(self.unattended_file).read()
+
+        logging.debug("Unattended install contents:")
+        for line in contents.splitlines():
+            logging.debug(line)
+
+
     def setup_boot_disk(self):
         if self.unattended_file.endswith('.sif'):
             dest_fname = 'winnt.sif'
@@ -492,6 +520,9 @@ class UnattendedInstallConfig(object):
                                 (self.cdrom_cd1_mount, self.boot_path,
                                  os.path.basename(self.initrd), self.initrd))
             utils.run(initrd_fetch_cmd)
+            if self.unattended_file.endswith('.preseed'):
+                self.preseed_initrd()
+
         finally:
             cleanup(self.cdrom_cd1_mount)
 
Signature · 1 line
1.7.6.4
#2 lore raw

PATCH 2/2 KVM test: guest-os.cfg: Introduce Ubuntu 11.04 server variant

In reply to Lucas Meneghel Rodrigues

Add a Ubuntu 11.04 server variant, with unattended install set. With this, it's possible to install the latest Ubuntu server (as of the time of this patch). A preseed file comes together.

---
 client/tests/kvm/guest-os.cfg.sample             |   34 ++++++++++++++----
 client/tests/kvm/unattended/Ubuntu-11-04.preseed |   42 ++++++++++++++++++++++
 2 files changed, 69 insertions(+), 7 deletions(-)
 create mode 100644 client/tests/kvm/unattended/Ubuntu-11-04.preseed
client/tests/kvm/guest-os.cfg.sample +27 -7
index 17d6114..f7d5a98 100644
@@ -906,29 +906,35 @@ variants:
                             md5sum_cd1 = d2e10420f3689faa49a004b60fb396b7
                             md5sum_1m_cd1 = f7f67b5da46923a9f01da8a2b6909654
 
-            - @Ubuntu:
+            - Ubuntu:
                 shell_prompt = "^root@.*[\#\$]\s*$"
+                password = 12345678
+                image_name = ubuntu
+                unattended_install:
+                    kernel = linux
+                    initrd = initrd
+                    wait_no_ack = yes
 
                 variants:
-                    - Ubuntu-6.10-32:
+                    - 6.10-32:
                         only install
-                        image_name = ubuntu-6.10-32
+                        image_name += -6.10-32
                         steps = steps/Ubuntu-6.10-32.steps
                         cdrom_cd1 = isos/linux/ubuntu-6.10-desktop-i386.iso
                         md5sum_cd1 = 17fb825641571ce5888a718329efd016
                         md5sum_1m_cd1 = 7531d0a84e7451d17c5d976f1c3f8509
 
-                    - Ubuntu-8.04-32:
+                    - 8.04-32:
                         skip = yes
-                        image_name = ubuntu-8.04-32
+                        image_name += -8.04-32
                         install:
                             steps = steps/Ubuntu-8.04-32.steps
                             cdrom_cd1 = isos/linux/ubuntu-8.04.1-desktop-i386.iso
                         setup:
                             steps = steps/Ubuntu-8.04-32-setupssh.steps
 
-                    - Ubuntu-8.10-server-32:
-                        image_name = ubuntu-8.10-server-32
+                    - 8.10-server-32:
+                        image_name += -8.10-server-32
                         install:
                             steps = steps/Ubuntu-8.10-server-32.steps
                             cdrom_cd1 = isos/linux/ubuntu-8.10-server-i386.iso
@@ -937,6 +943,20 @@ variants:
                         setup:
                             steps = steps/Ubuntu-8.10-server-32-gcc.steps
 
+                    - 11.04-server-64:
+                        image_name += -11.04-server-64
+                        unattended_install:
+                            extra_params += " --append 'console=ttyS0,115200 console=tty0'"
+                            kernel = images/ubuntu-server-11-04-64/vmlinuz
+                            initrd = images/ubuntu-server-11-04-64/initrd.gz
+                            boot_path = install
+                        unattended_install.cdrom:
+                            unattended_file = unattended/Ubuntu-11-04.preseed
+                            cdrom_cd1 = isos/linux/ubuntu-11.04-server-amd64.iso
+                            md5sum_cd1 = 355ca2417522cb4a77e0295bf45c5cd5
+                            md5sum_1m_cd1 = 65b1514744bf99e88f6228e9b6f152a8
+
+
             - DSL-4.2.5:
                 no setup dbench bonnie linux_s3
                 image_name = dsl-4.2.5
client/tests/kvm/unattended/Ubuntu-11-04.preseed new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
1.7.6.4