Class: Vmit::DebianPreseed

Inherits:
UnattendedInstall show all
Defined in:
lib/vmit/debian_preseed.rb

Overview

Some good references here: www.hps.com/~tpg/notebook/autoinstall.php

Instance Attribute Summary

Attributes inherited from UnattendedInstall

#config, #location

Instance Method Summary collapse

Methods inherited from UnattendedInstall

#initialize

Constructor Details

This class inherits a constructor from Vmit::UnattendedInstall

Instance Method Details

#execute_autoinstall(vm, args) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vmit/debian_preseed.rb', line 30

def execute_autoinstall(vm, args)
  vm.config.push!
  begin
    vm.config.configure(args)
    Dir.mktmpdir do |floppy_dir|
      FileUtils.chmod_R 0755, floppy_dir
      vm.config.floppy = floppy_dir
      vm.config.add_kernel_cmdline!('preseed/file=/floppy/preseed.cfg')
      vm.config.add_kernel_cmdline!('auto=true')
      vm.config.add_kernel_cmdline!('priority=critical')
      vm.config.reboot = false

      File.write(File.join(floppy_dir, 'preseed.cfg'), to_txt)
      Vmit.logger.info "Preseed: 1st stage."
      vm.up
      vm.wait_until_shutdown! do
        vm.vnc
      end
    end
  ensure
    vm.config.pop!
  end
end

#to_txtObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/vmit/debian_preseed.rb', line 54

def to_txt
  template = ERB.new "d-i debconf/priority select critical\nd-i auto-install/enabled boolean true\nd-i debian-installer/locale string en_US\nd-i console-tools/archs select at\nd-i console-keymaps-at/keymap select American English\n\nd-i debian-installer/keymap string us\n\nd-i netcfg/choose_interface            select auto\nd-i netcfg/get_hostname string unassigned-hostname\nd-i netcfg/get_hostname seen true\nd-i netcfg/get_domain string unassigned-domain\nd-i netcfg/get_domain seen true\n\nd-i mirror/protocol string ftp\nd-i mirror/ftp/hostname string ftp.de.debian.org\nd-i mirror/ftp/directory string /debian/\nd-i mirror/ftp/proxy string\n\nd-i partman-auto/method string regular\nd-i partman-partitioning/confirm_write_new_label boolean true\nd-i partman/choose_partition select finish\nd-i partman/confirm boolean true\nd-i partman/confirm_nooverwrite boolean true\n\nd-i clock-setup/utc boolean true\nd-i time/zone string US/Eastern\nd-i clock-setup/ntp boolean true\npopularity-contest popularity-contest/participate boolean false\n\nd-i pkgsel/include string ssh rsync initrd-tools cramfsprogs lzop\n\nd-i passwd/root-login boolean true\nd-i passwd/root-password password linux\nd-i passwd/root-password-again password linux\nd-i passwd/make-user boolean false\nd-i grub-installer/only_debian boolean true\n"
  return template.result(binding)
end