7 from subprocess import call
9 data_dir = '/srv/guest-installer'
11 def make_debian_cd(name, tmptree, passhashfile):
12 basetree = os.path.join(data_dir, name)
13 cdtree = os.path.join(tmptree, 'cdrom')
14 shutil.copytree(os.path.join(basetree, 'cdrom'), cdtree, symlinks=True)
15 new_preseed = file(os.path.join(cdtree, 'preseed.cfg'), 'w')
16 old_preseed = file(os.path.join(basetree, 'preseed.cfg'))
17 new_preseed.write(old_preseed.read())
18 passhash = file(passhashfile).read()
19 new_preseed.write('d-i passwd/root-password-crypted password '+passhash+'\n')
21 output_iso = os.path.join(tmptree, 'install.iso')
22 call('''mkisofs -r -V "SIPB-Xen_Custom_Install_CD" -cache-inodes -J -l
23 -b isolinux/isolinux.bin -c isolinux/boot.cat
24 -no-emul-boot -boot-load-size 4 -boot-info-table'''.split()
25 + ['-o', output_iso, cdtree])
28 if __name__ == '__main__':
29 print make_debian_cd(*sys.argv[1:])