X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-autoinstaller.git/blobdiff_plain/4814dbe5abdf5f4ed0421b94648c13a4d47ff159..dfaf9cfe97ae787cfae45e0860a8717cb20b7028:/host/usr/sbin/sipb-xen-make-iso diff --git a/host/usr/sbin/sipb-xen-make-iso b/host/usr/sbin/sipb-xen-make-iso new file mode 100755 index 0000000..9b959cb --- /dev/null +++ b/host/usr/sbin/sipb-xen-make-iso @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import sys +import os +import shutil +import tempfile +from subprocess import call + +data_dir = '/srv/guest-installer' + +def make_debian_cd(name, tmptree, passhashfile): + basetree = os.path.join(data_dir, name) + 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') + old_preseed = file(os.path.join(basetree, 'preseed.cfg')) + new_preseed.write(old_preseed.read()) + passhash = file(passhashfile).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:])