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. Signed-off-by: Lucas Meneghel Rodrigues <l...@redhat.com> --- client/tests/kvm/tests/unattended_install.py | 31 ++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py index b1d23f6..f3f5268 100644 --- a/client/tests/kvm/tests/unattended_install.py +++ b/client/tests/kvm/tests/unattended_install.py @@ -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) -- 1.7.6.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html