111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
# File 'lib/vmit/bootstrap.rb', line 111
def execute_autoinstall(args)
auto_install_args = {}
auto_install_args.merge!(args)
kernel_append_arg = case media
when Vmit::VFS::URI then "install=#{location}"
when Vmit::VFS::ISO then 'install=cdrom'
else raise ArgumentError.new("Unsupported autoinstallation: #{location}")
end
auto_install_args.merge!(:append => kernel_append_arg)
if media.is_a?(Vmit::VFS::ISO)
auto_install_args.merge!(:cdrom => location.to_s)
end
Dir.mktmpdir do |floppy_dir|
qemu_args = {:floppy => floppy_dir,
:append => "autoyast=device://fd0/autoinst.xml",
:reboot => false}
qemu_args.merge!(auto_install_args) do |key, oldv, newv|
case key
when :append then [oldv, newv].flatten
else newv
end
end
autoyast = Vmit::AutoYaST.new
media.open('/content') do |content_file|
content_file.each_line do |line|
case line
when /^DISTRIBUTION (.+)$/
case $1
when /SUSE_SLE/ then autoyast.minimal_sle!
when /openSUSE/ then autoyast.minimal_opensuse!
end
end
end
end
File.write(File.join(floppy_dir, 'autoinst.xml'), autoyast.to_xml)
Vmit.logger.info "AutoYaST: 1st stage."
vm.run(qemu_args)
Vmit.logger.info "AutoYaST: 2st stage."
vm.run(:reboot => false)
end
end
|