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

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

postinst script, nicer pathnames, and read password hash from a file

The postinst script has been tested by running it directly,
but I still haven't attempted actually building and installing
the package.

  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#!/usr/bin/env python
2
3import sys
4import os
5import shutil
6import tempfile
7from subprocess import call
8
9data_dir = '/srv/guest-installer'
10
11def make_debian_cd(name, passhashfile):
12  basetree = os.path.join(data_dir, name)
13  tmptree = tempfile.mkdtemp('', 'auto-install.', '/tmp')
14  cdtree = os.path.join(tmptree, 'cdrom')
15  shutil.copytree(os.path.join(basetree, 'cdrom'), cdtree, symlinks=True)
16  new_preseed = file(os.path.join(cdtree, 'preseed.cfg'), 'w')
17  old_preseed = file(os.path.join(basetree, 'preseed.cfg'))
18  new_preseed.write(old_preseed.read())
19  passhash = file(passhashfile).read()
20  new_preseed.write('d-i passwd/root-password-crypted password '+passhash+'\n')
21  new_preseed.close()
22  output_iso = os.path.join(tmptree, 'install.iso')
23  call('''mkisofs -r -V "SIPB-Xen_Custom_Install_CD" -cache-inodes -J -l
24           -b isolinux/isolinux.bin -c isolinux/boot.cat
25           -no-emul-boot -boot-load-size 4 -boot-info-table'''.split()
26       + ['-o', output_iso, cdtree])
27  return output_iso
28
29if __name__ == '__main__':
30  print make_debian_cd(*sys.argv[1:])
Note: See TracBrowser for help on using the repository browser.