Throw out old old installer.
[invirt/packages/invirt-autoinstaller.git] / files / usr / sbin / sipb-xen-make-iso
1 #!/usr/bin/env python
2
3 import sys
4 import os
5 import shutil
6 import tempfile
7 from subprocess import call
8
9 data_dir = '/srv/guest-installer'
10
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')
20   new_preseed.close()
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])
26   return output_iso
27
28 if __name__ == '__main__':
29   print make_debian_cd(*sys.argv[1:])