From: Greg Price <price@mit.edu>
Date: Sun, 28 Oct 2007 05:08:34 +0000 (-0400)
Subject: Use temp directory, use DHCP, and live in sane paths.
X-Git-Tag: sipb-xen-guest-installer/1.0~9
X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-autoinstaller.git/commitdiff_plain/a648e15e27104d03c7489c6c4c494022457ed06e

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.


svn path=/trunk/packages/sipb-xen-guest-installer/sipb-xen-guest-installer/; revision=218
---

diff --git a/partial/cdrom.patch b/files/srv/guest-installer/etch/cdrom.patch
similarity index 100%
rename from partial/cdrom.patch
rename to files/srv/guest-installer/etch/cdrom.patch
diff --git a/partial/iso.url b/files/srv/guest-installer/etch/iso.url
similarity index 100%
rename from partial/iso.url
rename to files/srv/guest-installer/etch/iso.url
diff --git a/partial/preseed.cfg b/files/srv/guest-installer/etch/preseed.cfg
similarity index 94%
rename from partial/preseed.cfg
rename to files/srv/guest-installer/etch/preseed.cfg
index ee13a7f..2e309de 100644
--- a/partial/preseed.cfg
+++ b/files/srv/guest-installer/etch/preseed.cfg
@@ -8,18 +8,7 @@ d-i console-keymaps-at/keymap select us
 d-i netcfg/choose_interface select auto
 
 #d-i netcfg/dhcp_timeout string 1
-
-d-i netcfg/use_dhcp boolean false
-# If you prefer to configure the network manually, uncomment this line and
-# the static network configuration below.
-d-i netcfg/disable_dhcp boolean true
-
-# Static network configuration.
-d-i netcfg/get_nameservers string 18.72.0.3
-# at bottom  #d-i netcfg/get_ipaddress string fillme
-d-i netcfg/get_netmask string 255.255.0.0
-d-i netcfg/get_gateway string 18.181.0.1
-d-i netcfg/confirm_static boolean true
+d-i netcfg/use_dhcp boolean true
 
 # Any hostname and domain names assigned from dhcp take precedence over
 # values set here. However, setting the values still prevents the questions
@@ -232,6 +221,4 @@ d-i finish-install/reboot_in_progress note
 
 
 # sipb-xen: automatically filled-in values get appended here. 
-# at bottom  #d-i netcfg/get_ipaddress string fillme
-# at bottom  #d-i netcfg/get_hostname string fillme
 # at bottom  #d-i passwd/root-password-crypted password [MD5 hash]
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:])