--- /dev/null
+#!/usr/bin/env python
+
+import sys
+import os
+import shutil
+import tempfile
+from subprocess import call
+
+def make_debian_cd(basetree, passhash):
+ old_preseed = file(os.path.join(basetree, 'preseed.cfg'))
+ tmptree = tempfile.mkdtemp('', 'auto-install.', '/tmp')
+ cdtree = os.path.join(tmptree, 'cdrom')
+ shutil.copytree(os.path.join(basetree, 'cdrom'), cdtree, symlinks=True)
+ new_preseed = file(os.path.join(cdtree, 'preseed.cfg'), 'w')
+ new_preseed.write(old_preseed.read())
+ new_preseed.write('d-i passwd/root-password-crypted password '+passhash+'\n')
+ new_preseed.close()
+ output_iso = os.path.join(tmptree, 'install.iso')
+ call('''mkisofs -r -V "SIPB-Xen_Custom_Install_CD" -cache-inodes -J -l
+ -b isolinux/isolinux.bin -c isolinux/boot.cat
+ -no-emul-boot -boot-load-size 4 -boot-info-table'''.split()
+ + ['-o', output_iso, cdtree])
+ return output_iso
+
+if __name__ == '__main__':
+ print make_debian_cd(*sys.argv[1:])