X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-autoinstaller.git/blobdiff_plain/8e7f279ddc6d80280e7223c76c8744a247b512cf:/partial/sipb-xen-make-iso.py..a648e15e27104d03c7489c6c4c494022457ed06e:/files/usr/sbin/sipb-xen-make-iso diff --git a/partial/sipb-xen-make-iso.py b/files/usr/sbin/sipb-xen-make-iso similarity index 63% rename from partial/sipb-xen-make-iso.py rename to files/usr/sbin/sipb-xen-make-iso index 5eadd32..82abba9 100755 --- a/partial/sipb-xen-make-iso.py +++ b/files/usr/sbin/sipb-xen-make-iso @@ -2,21 +2,25 @@ import sys import os +import shutil +import tempfile from subprocess import call -def make_debian_cd(basetree, guest_ip, guest_hostname, passhash, output_iso): +def make_debian_cd(basetree, passhash): old_preseed = file(os.path.join(basetree, 'preseed.cfg')) - cdtree = os.path.join(basetree, 'cdrom') + 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 netcfg/get_ipaddress string '+guest_ip+'\n') - new_preseed.write('d-i netcfg/get_hostname string '+guest_hostname+'\n') 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__': - make_debian_cd(*sys.argv[1:]) + print make_debian_cd(*sys.argv[1:])