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