source: trunk/packages/sipb-xen-guest-installer/sipb-xen-guest-installer/files/usr/sbin/sipb-xen-make-iso @ 218

Last change on this file since 218 was 218, checked in by price, 17 years ago

Use temp directory, use DHCP, and live in sane paths.

The partial/ tree is gone now.
Files are in files/; the installer's persistent data
will go in subtrees like /srv/guest-installer/etch/.

Also, it magically takes only 15 minutes now.

  • Property svn:executable set to *
File size: 958 bytes
RevLine 
[201]1#!/usr/bin/env python
2
3import sys
4import os
[218]5import shutil
6import tempfile
[201]7from subprocess import call
8
[218]9def make_debian_cd(basetree, passhash):
[201]10  old_preseed = file(os.path.join(basetree, 'preseed.cfg'))
[218]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)
[201]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')
17  new_preseed.close()
[218]18  output_iso = os.path.join(tmptree, 'install.iso')
[201]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])
[218]23  return output_iso
[201]24
25if __name__ == '__main__':
[218]26  print make_debian_cd(*sys.argv[1:])
Note: See TracBrowser for help on using the repository browser.