le1t0-deprec 2.1.6.057 → 2.1.6.058

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/lib/deprec/recipes/app/passenger.rb +70 -18
  2. data/lib/deprec/recipes/iptables.rb +8 -9
  3. data/lib/deprec/recipes/profiles.rb +84 -0
  4. data/lib/deprec/recipes/redis.rb +2 -7
  5. data/lib/deprec/recipes/ruby/rvm.rb +75 -0
  6. data/lib/deprec/recipes/sphinx/thinking_sphinx.rb +3 -3
  7. data/lib/deprec/recipes/sphinx/ultrasphinx.rb +3 -3
  8. data/lib/deprec/recipes/syslog/syslog_ng.rb +6 -6
  9. data/lib/deprec/recipes/ubuntu.rb +35 -0
  10. data/lib/deprec/recipes/xen.rb +97 -29
  11. data/lib/deprec/recipes/xentools.rb +97 -58
  12. data/lib/deprec/templates/iptables/firewall-init.erb +141 -175
  13. data/lib/deprec/templates/passenger/passenger.conf.erb +1 -1
  14. data/lib/deprec/templates/redis/redis-conf.erb +225 -45
  15. data/lib/deprec/templates/ubuntu/getlibs.erb +599 -0
  16. data/lib/deprec/templates/xentools/{98-custom → 01-mount-devpts.erb} +2 -5
  17. data/lib/deprec/templates/xentools/98-custom.erb +42 -0
  18. data/lib/deprec/templates/xentools/99-devpts-umount.erb +14 -0
  19. data/lib/deprec/templates/xentools/kernel-img.conf.example.erb +10 -0
  20. data/lib/deprec/templates/xentools/update-grub-xenu.example.erb +4 -0
  21. data/lib/deprec/templates/xentools/xm.tmpl.erb +20 -48
  22. data/lib/deprec.rb +15 -1
  23. metadata +18 -13
  24. data/lib/deprec/recipes/rvm.rb +0 -32
  25. data/lib/deprec/templates/iptables/firewall-default.erb +0 -13
  26. data/lib/deprec/templates/xentools/100-ubuntu-setup +0 -26
  27. data/lib/deprec/templates/xentools/15-disable-hwclock +0 -40
  28. data/lib/deprec/templates/xentools/30-disable-gettys +0 -57
  29. data/lib/deprec/templates/xentools/31-ubuntu-setup +0 -32
  30. data/lib/deprec/templates/xentools/40-setup-networking +0 -145
  31. data/lib/deprec/templates/xentools/xen-tools.conf.erb +0 -278
@@ -1,11 +1,3 @@
1
- def handle_xen_images(&block)
2
- do_xen_images = (ENV['ONLY'] || '').split(',')
3
- xen_images.each do |xen_image|
4
- next if do_xen_images.size > 0 && !do_xen_images.include?(xen_image[:hostname])
5
- yield(xen_image)
6
- end
7
- end
8
-
9
1
  # Copyright 2006-2010 by Mike Bailey, le1t0@github. All rights reserved.
10
2
  Capistrano::Configuration.instance(:must_exist).load do
11
3
  namespace :deprec do
@@ -23,7 +15,7 @@ Capistrano::Configuration.instance(:must_exist).load do
23
15
  # :swap => '2Gb',
24
16
  # :ip => '10.0.2.1',
25
17
  # :mac => '00:16:3e:00:00:01',
26
- # :vcups => 3, # specify amount of vcpus to use, this will be put in the VM config in /etc/xen/
18
+ # :vcpus => 3, # specify amount of vcpus to use, this will be put in the VM config in /etc/xen/
27
19
  # :cpus => '1,3,6', # specify list of cpus to use, this will be put in the VM config in /etc/xen/
28
20
  # :arch => 'i386' # specify to create an i386 VM if you have a x86_64 host for example; optional.
29
21
  # },
@@ -37,7 +29,7 @@ Capistrano::Configuration.instance(:must_exist).load do
37
29
  # :swap => '2Gb',
38
30
  # :ip => '10.0.2.1',
39
31
  # :mac => '00:16:3e:00:00:01',
40
- # :vcups => 3, # specify amount of vcpus to use, this will be put in the VM config in /etc/xen/
32
+ # :vcpus => 3, # specify amount of vcpus to use, this will be put in the VM config in /etc/xen/
41
33
  # :cpus => '1,3,6', # specify list of cpus to use, this will be put in the VM config in /etc/xen/
42
34
  # }
43
35
  # ]
@@ -251,46 +243,122 @@ Capistrano::Configuration.instance(:must_exist).load do
251
243
  # The images to create are matched on the :hostname value in :xen_images
252
244
  desc "Create Xen images"
253
245
  task :create_images, :roles => :dom0 do
254
- handle_xen_images do |xen_image|
255
- args = []
256
- vcpus = xen_image.delete(:vcpus)
257
- cpus = xen_image.delete(:cpus)
258
- xen_image.each do |k,v|
259
- args << "--#{k}='#{v}'"
246
+ do_xen_images = (ENV['ONLY'] || '').split(',')
247
+ xen_images_list = {}
248
+ find_servers.collect { |server| server.host }.each do |host|
249
+ scope host do
250
+ xen_images_list[host] = (xen_images || []).collect do |xen_image|
251
+ args = ([xen_image[:hostname]] + xen_image.collect do |k,v|
252
+ "--#{k}=#{v}" unless [ :vcpus, :cpus ].include?(k)
253
+ end.compact).join(' ')
254
+ cpus = [xen_image[:hostname], xen_image[:vcpus] || 1, xen_image[:cpus]].compact.join(' ')
255
+ do_xen_images.size == 0 || do_xen_images.include?(xen_image[:hostname]) ? [ args, cpus ] : nil
256
+ end.compact
260
257
  end
261
- cmd = "sh -c \"[ -e /etc/xen/#{xen_image[:hostname]}.cfg ] || /usr/bin/xen-create-image #{args.join(' ')}\""
262
- sudo cmd
263
- deprec2.append_to_file_if_missing("/etc/xen/#{xen_image[:hostname]}.cfg", "vcpus = '#{vcpus}'") unless vcpus.nil?
264
- deprec2.append_to_file_if_missing("/etc/xen/#{xen_image[:hostname]}.cfg", "cpus = '#{cpus}'") unless cpus.nil?
265
258
  end
259
+
260
+ std.su_put "", tmpfile_xi = "/tmp/xen_images.#{Time.now.strftime("%Y%m%d%H%M%S")}.txt", '/tmp/', :mode=>0644, :proc => Proc.new { |from, host|
261
+ image_list = xen_images_list[host].collect { |ar| ar[0] }.join("\n").strip
262
+ image_list.empty? ? image_list : image_list + "\n"
263
+ }
264
+ std.su_put "", tmpfile_xc = "/tmp/xen_cpus.#{Time.now.strftime("%Y%m%d%H%M%S")}.txt", '/tmp/', :mode=>0644, :proc => Proc.new { |from, host|
265
+ image_list = xen_images_list[host].collect { |ar| ar[1] }.join("\n").strip
266
+ image_list.empty? ? image_list : image_list + "\n"
267
+ }
268
+
269
+ run <<-EOF
270
+ cat #{tmpfile_xi} | while read xen_image opts ; do {
271
+ [ -e /etc/xen/${xen_image}.cfg -o -z "${xen_image}" ] || echo sudo /usr/bin/xen-create-image ${opts} ;
272
+ [ -e /etc/xen/${xen_image}.cfg -o -z "${xen_image}" ] || sudo /usr/bin/xen-create-image ${opts} ;
273
+ } ; done
274
+ EOF
275
+ run <<-EOF
276
+ cat #{tmpfile_xc} | while read xen_image vcpus cpus ; do {
277
+ tmpfile="/tmp/.${xen_image}.xen_config.$(date +"%Y%m%d%H%M%S").txt" ;
278
+ [ -z "${vcpus}" -a -z "${cpus}" ] || cat /etc/xen/${xen_image}.cfg > ${tmpfile} ;
279
+ [ -z "${vcpus}" -a -z "${cpus}" ] || echo >> ${tmpfile} ;
280
+ [ -z "${vcpus}" ] || echo "vcpus = '${vcpus}'" >> ${tmpfile} ;
281
+ [ -z "${cpus}" ] || echo "cpus = '${cpus}'" >> ${tmpfile} ;
282
+ [ -z "${vcpus}" -a -z "${cpus}" ] || sudo mv ${tmpfile} /etc/xen/${xen_image}.cfg ;
283
+ } ; done
284
+ EOF
285
+ sudo "rm -f #{tmpfile_xi} #{tmpfile_xc}"
266
286
  top.deprec.xen.auto_start_images
267
287
  end
268
288
 
269
289
  # Same explanation as for create_images, but in this case for registering images to be auto-started at host sys boot up
270
290
  desc "Make links for xen image configs to be started automatically"
271
291
  task :auto_start_images, :roles => :dom0 do
272
- handle_xen_images do |xen_image|
273
- cmd = "sh -c \"ln -nsf /etc/xen/#{xen_image[:hostname]}.cfg /etc/xen/auto/#{xen_image[:hostname]}.cfg\""
274
- sudo cmd
292
+ do_xen_images = (ENV['ONLY'] || '').split(',')
293
+ xen_images_list = {}
294
+ find_servers.collect { |server| server.host }.each do |host|
295
+ scope host do
296
+ xen_images_list[host] = (xen_images || []).collect do |xen_image|
297
+ do_xen_images.size == 0 || do_xen_images.include?(xen_image[:hostname]) ? xen_image[:hostname] : nil
298
+ end.compact.join("\n").strip
299
+ end
275
300
  end
301
+
302
+ std.su_put "", tmpfile = "/tmp/xen_images.#{Time.now.strftime("%Y%m%d%H%M%S")}.txt", '/tmp/', :mode=>0644, :proc => Proc.new { |from, host|
303
+ xen_images_list[host].empty? ? xen_images_list[host] : xen_images_list[host] + "\n"
304
+ }
305
+
306
+ run <<-EOF
307
+ cat #{tmpfile} | while read xen_image ; do {
308
+ [ -z "${xen_image}" ] || sudo ln -nsf /etc/xen/${xen_image}.cfg /etc/xen/auto/${xen_image}.cfg ;
309
+ } ; done
310
+ EOF
311
+ sudo "rm -f #{tmpfile}"
276
312
  end
277
313
 
278
314
  # Same explanation as for create_images, but in this case for unregistering images to be auto-started at host sys boot up
279
315
  desc "Make links for xen image configs to be started automatically"
280
316
  task :undo_auto_start_images, :roles => :dom0 do
281
- handle_xen_images do |xen_image|
282
- cmd = "sh -c \"rm -f /etc/xen/auto/#{xen_image[:hostname]}.cfg\""
283
- sudo cmd
317
+ do_xen_images = (ENV['ONLY'] || '').split(',')
318
+ xen_images_list = {}
319
+ find_servers.collect { |server| server.host }.each do |host|
320
+ scope host do
321
+ xen_images_list[host] = (xen_images || []).collect do |xen_image|
322
+ do_xen_images.size == 0 || do_xen_images.include?(xen_image[:hostname]) ? xen_image[:hostname] : nil
323
+ end.compact.join("\n").strip
324
+ end
284
325
  end
326
+
327
+ std.su_put "", tmpfile = "/tmp/xen_images.#{Time.now.strftime("%Y%m%d%H%M%S")}.txt", '/tmp/', :mode=>0644, :proc => Proc.new { |from, host|
328
+ xen_images_list[host].empty? ? xen_images_list[host] : xen_images_list[host] + "\n"
329
+ }
330
+
331
+ run <<-EOF
332
+ cat #{tmpfile} | while read xen_image ; do {
333
+ [ -z "${xen_image}" ] || sudo rm -f /etc/xen/auto/${xen_image}.cfg ;
334
+ } ; done
335
+ EOF
336
+ sudo "rm -f #{tmpfile}"
285
337
  end
286
338
 
287
339
  # Same explanation as for create_images, but in this case for starting images
288
340
  desc "Start Xen images"
289
341
  task :start_images, :roles => :dom0 do
290
- handle_xen_images do |xen_image|
291
- cmd = "sh -c '/usr/sbin/xm create #{xen_image[:hostname]}.cfg 1>/dev/null ; true'"
292
- sudo cmd
342
+ do_xen_images = (ENV['ONLY'] || '').split(',')
343
+ xen_images_list = {}
344
+ find_servers.collect { |server| server.host }.each do |host|
345
+ scope host do
346
+ xen_images_list[host] = (xen_images || []).collect do |xen_image|
347
+ do_xen_images.size == 0 || do_xen_images.include?(xen_image[:hostname]) ? xen_image[:hostname] : nil
348
+ end.compact.join("\n").strip
349
+ end
293
350
  end
351
+
352
+ std.su_put "", tmpfile = "/tmp/xen_images.#{Time.now.strftime("%Y%m%d%H%M%S")}.txt", '/tmp/', :mode=>0644, :proc => Proc.new { |from, host|
353
+ xen_images_list[host].empty? ? xen_images_list[host] : xen_images_list[host] + "\n"
354
+ }
355
+
356
+ run <<-EOF
357
+ cat #{tmpfile} | while read xen_image ; do {
358
+ [ -z "${xen_image}" ] || sudo /usr/sbin/xm create ${xen_image}.cfg 1>/dev/null ;
359
+ } ; done
360
+ EOF
361
+ sudo "rm -f #{tmpfile}"
294
362
  end
295
363
 
296
364
  # show configs of all registered VMs on host system, use grep to get certain info fields
@@ -3,86 +3,107 @@ Capistrano::Configuration.instance(:must_exist).load do
3
3
  namespace :deprec do
4
4
  namespace :xentools do
5
5
 
6
- SRC_PACKAGES[:xentools] = {
7
- :url => "http://www.xen-tools.org/software/xen-tools/xen-tools-4.1.tar.gz",
8
- :md5sum => "156ec5991f3885ef0daa58c3424d0a35 xen-tools-4.1.tar.gz",
9
- :configure => '',
10
- :make => ''
11
- }
12
-
6
+ set :xentools_default_lvm, 'xendisks' # for ubuntu default, set to nil
7
+ set :xentools_default_memory, '256Mb' # for ubuntu default, set to '128Mb'
8
+ set :xentools_default_swap, '512Mb' # for ubuntu default, set to '128Mb'
9
+ set :xentools_default_dist, 'hardy' # for ubuntu default, set to 'etch'
10
+ set :xentools_default_gateway, '192.168.1.1' # for ubuntu default, set to nil
11
+ set :xentools_default_netmask, '255.255.255.0' # for ubuntu default, set to nil
12
+ set :xentools_default_broadcast, '192.168.1.255' # for ubuntu default, set to nil
13
+ set :xentools_default_arch, nil # for ubuntu default, set to nil
14
+ set :xentools_default_mirror, 'http://archive.ubuntu.com/ubuntu/' # for ubuntu default, set to 'http://ftp.us.debian.org/debian/'
15
+ set :xentools_default_serial_device, nil # for ubuntu default, set to nil
16
+ set :xentools_default_disk_device, 'xvda' # for ubuntu default, set to 'xvda'
17
+ set :xentools_default_size, '4Gb' # ubuntu & deprec default
18
+ set :xentools_default_fs, 'ext3' # ubuntu & deprec default
19
+ set :xentools_default_image, 'sparse' # ubuntu & deprec default
20
+ set :xentools_default_noswap, nil # ubuntu & deprec default
21
+ set :xentools_default_dir, nil # ubuntu & deprec default
22
+ set :"xentools_default_install-method", 'debootstrap' # ubuntu & deprec default
23
+ set :"xentools_default_install-source", nil # ubuntu & deprec default
24
+ set :"xentools_default_copy-cmd", nil # ubuntu & deprec default
25
+ set :"xentools_default_debootstrap-cmd", nil # ubuntu & deprec default
26
+ set :"xentools_default_tar-cmd", nil # ubuntu & deprec default
27
+ set :xentools_default_dhcp, nil # ubuntu & deprec default
28
+ set :xentools_default_cache, nil # ubuntu & deprec default
29
+ set :xentools_default_passwd, nil # ubuntu & deprec default
30
+ set :xentools_default_accounts, nil # ubuntu & deprec default
31
+ set :xentools_default_kernel, '/boot/vmlinuz-`uname -r`' # ubuntu & deprec default
32
+ set :xentools_default_initrd, '/boot/initrd.img-`uname -r`' # ubuntu & deprec default
33
+ set :xentools_default_boot, nil # ubuntu & deprec default
34
+ set :xentools_default_bootloader, nil # ubuntu & deprec default, set to '/usr/bin/pygrub' for pygrub loading of VMs
35
+ set :xentools_default_ext3_options, 'noatime,nodiratime,errors=remount-ro' # ubuntu & deprec default
36
+ set :xentools_default_ext2_options, 'noatime,nodiratime,errors=remount-ro' # ubuntu & deprec default
37
+ set :xentools_default_xfs_options, 'defaults' # ubuntu & deprec default
38
+ set :xentools_default_reiser_options, 'defaults' # ubuntu & deprec default
39
+ set :xentools_enable_modules, false # if true, modules will be set to /lib/modules/`uname -r`, for ubuntu default, set to false
40
+ set :xentools_enable_eth0_tx, true # for ubuntu default, set to false
41
+
42
+ set :xentools_custom_commands_pre, nil # should be a string
43
+ set :xentools_custom_commands_post, nil # should be a string
44
+ set :xentools_no_utc, false
45
+ set :xentools_enable_sudo_in_sudoers, false
46
+ set :xentools_deploy_user, nil
47
+ set :xentools_deploy_group, nil
48
+ set :xentools_copy_localtime, false
49
+ set :xentools_disable_hwclock, false
50
+ set :xentools_dist_upgrade, false
51
+
13
52
  desc "Install xen-tools"
14
53
  task :install, :roles => :dom0 do
15
54
  install_deps
16
- deprec2.download_src(SRC_PACKAGES[:xentools], src_dir)
17
- deprec2.install_from_src(SRC_PACKAGES[:xentools], src_dir)
18
- initial_config
55
+ top.deprec.xentools.fix_config
19
56
  end
20
57
 
21
58
  task :install_deps, :roles => :dom0 do
22
- # Cheeky way to ensure we have the dependencies - Mike
23
59
  apt.install( {:base => %w(xen-tools libexpect-perl)}, :stable )
24
60
  end
25
61
 
62
+ task :fix_config, :roles => :dom0 do
63
+ sudo "perl -p -i -e 's/^#\\//#!\\//;' /usr/lib/xen-tools/gutsy.d/31-ubuntu-setup"
64
+ sudo "perl -p -i -e 's/^#\\//#!\\//; s/^prefix=\\$i/prefix=\\$1/' /usr/lib/xen-tools/gutsy.d/100-ubuntu-setup"
65
+ run "[ -e /etc/xen-tools/xen-tools.conf.bak ] || sudo cp /etc/xen-tools/xen-tools.conf /etc/xen-tools/xen-tools.conf.bak"
66
+ sudo "perl -p -i -e 's/^\\s*#\\s*[^\\n]*\\n//' /etc/xen-tools/xen-tools.conf"
67
+ sudo "perl -p -i -e 's/^[^ \\t]*\\n//' /etc/xen-tools/xen-tools.conf"
68
+ end
69
+
26
70
  SYSTEM_CONFIG_FILES[:xentools] = [
27
71
 
28
- {:template => "xen-tools.conf.erb",
29
- :path => '/etc/xen-tools/xen-tools.conf',
30
- :mode => 0644,
31
- :owner => 'root:root'},
32
-
33
72
  {:template => "xm.tmpl.erb",
34
73
  :path => '/etc/xen-tools/xm.tmpl',
35
74
  :mode => 0644,
36
75
  :owner => 'root:root'},
37
76
 
38
- # This one is a bugfix for gutsy
39
- {:template => "15-disable-hwclock",
40
- :path => '/usr/lib/xen-tools/gutsy.d/15-disable-hwclock',
41
- :mode => 0755,
42
- :owner => 'root:root'},
77
+ # added script for user adjustments to debootstrap results
78
+ {:template => "98-custom.erb",
79
+ :path => '/usr/lib/xen-tools/hardy.d/98-custom',
80
+ :mode => 0755,
81
+ :owner => 'root:root'},
43
82
 
44
- # This one is a bugfix for gutsy: domU -> domU networking is screwy
45
- # http://lists.xensource.com/archives/html/xen-users/2006-05/msg00818.html
46
- {:template => "40-setup-networking",
47
- :path => '/usr/lib/xen-tools/gutsy.d/40-setup-networking',
48
- :mode => 0755,
49
- :owner => 'root:root'},
50
-
51
- # bugfix: #/bin/sh -> #!/bin/sh
52
- # bugfix: $i => $1
53
- {:template => "100-ubuntu-setup",
54
- :path => '/usr/lib/xen-tools/gutsy.d/100-ubuntu-setup',
55
- :mode => 0755,
56
- :owner => 'root:root'},
83
+ # added script for having /dev/pts mounted during running of hooks
84
+ {:template => "99-devpts-umount.erb",
85
+ :path => '/usr/lib/xen-tools/hardy.d/99-devpts-umount',
86
+ :mode => 0755,
87
+ :owner => 'root:root'},
57
88
 
58
- # bugfix: make sure serial device is created and correct file is edited (/etc/inittab is not used anymore!)
59
- {:template => "30-disable-gettys",
60
- :path => '/usr/lib/xen-tools/gutsy.d/30-disable-gettys',
61
- :mode => 0755,
62
- :owner => 'root:root'},
89
+ # added script for having /dev/pts mounted during running of hooks
90
+ {:template => "01-mount-devpts.erb",
91
+ :path => '/usr/lib/xen-tools/hardy.d/01-mount-devpts',
92
+ :mode => 0755,
93
+ :owner => 'root:root'},
63
94
 
64
- # bugfix: removed serial device code, since that's already performed in 30-disable-gettys
65
- # bugfix: #/bin/sh -> #!/bin/sh
66
- {:template => "31-ubuntu-setup",
67
- :path => '/usr/lib/xen-tools/gutsy.d/31-ubuntu-setup',
68
- :mode => 0755,
69
- :owner => 'root:root'},
95
+ # added script for auto updating of /boot/grub/menu.lst in xenU VM
96
+ {:template => "update-grub-xenu.example.erb",
97
+ :path => '/usr/local/share/xen-tools/update-grub-xenu.example',
98
+ :mode => 0755,
99
+ :owner => 'root:root'},
70
100
 
71
- # added script for user adjustments to debootstrap results
72
- # modify this file inside your project (i.e. not in deprec itself) to added your own xen-tools steps
73
- {:template => "98-custom",
74
- :path => '/usr/lib/xen-tools/gutsy.d/98-custom',
75
- :mode => 0755,
76
- :owner => 'root:root'}
101
+ {:template => "kernel-img.conf.example.erb",
102
+ :path => '/usr/local/share/xen-tools/kernel-img.conf.example',
103
+ :mode => 0755,
104
+ :owner => 'root:root'}
77
105
  ]
78
106
 
79
- task :initial_config, :roles => :dom0 do
80
- # Non-standard! We're pushing these straight out
81
- SYSTEM_CONFIG_FILES[:xentools].each do |file|
82
- deprec2.render_template(:xentools, file.merge(:remote => true))
83
- end
84
- end
85
-
86
107
  desc "Generate configuration file(s) for xen-tools from template(s)"
87
108
  task :config_gen do
88
109
  SYSTEM_CONFIG_FILES[:xentools].each do |file|
@@ -93,6 +114,24 @@ Capistrano::Configuration.instance(:must_exist).load do
93
114
  desc "Push xen-tools config files to server"
94
115
  task :config, :roles => :dom0 do
95
116
  deprec2.push_configs(:xentools, SYSTEM_CONFIG_FILES[:xentools])
117
+ # remove settings from xen-tools.conf in order to re-enable them later on (if set)
118
+ sudo "cp /etc/xen-tools/xen-tools.conf #{tmpfile = Time.now.strftime("/tmp/xen-tools.conf.%Y%m%d%H%M%S")}"
119
+ sudo "chmod 666 #{tmpfile}"
120
+ [ :lvm, :memory, :swap, :dist, :gateway, :netmask, :broadcast, :arch, :mirror, :serial_device, :disk_device, :size, :fs, :image, :noswap, :dir, :"install-method", :"install-source", :"copy-cmd", :"debootstrap-cmd", :"tar-cmd", :dhcp, :cache, :passwd, :accounts, :kernel, :initrd, :boot, :bootloader, :ext3_options, :ext2_options, :xfs_options, :reiser_options, :modules ].each do |v|
121
+ sudo "perl -p -i -e 's/^\\s*#{v}\\s*=[^\\n]*\\n//' #{tmpfile}"
122
+ end
123
+ [ :lvm, :memory, :swap, :dist, :gateway, :netmask, :broadcast, :arch, :mirror, :serial_device, :disk_device, :size, :fs, :image, :noswap, :dir, :"install-method", :"install-source", :"copy-cmd", :"debootstrap-cmd", :"tar-cmd", :dhcp, :cache, :passwd, :accounts, :kernel, :initrd, :boot, :bootloader, :ext3_options, :ext2_options, :xfs_options, :reiser_options ].each do |v|
124
+ run "echo '#{v} = #{send("xentools_default_#{v}".to_sym)}' >> #{tmpfile}" if send("xentools_default_#{v}".to_sym)
125
+ end
126
+ run "echo 'modules = /lib/modules/`uname -r`' >> #{tmpfile}" if xentools_enable_modules
127
+ sudo "chmod 644 #{tmpfile}"
128
+ sudo "mv #{tmpfile} /etc/xen-tools/xen-tools.conf"
129
+ # domU -> domU networking is screwy
130
+ if xentools_enable_eth0_tx
131
+ sudo "perl -p -i -e 's/^(\\s*)#(\\s*)(post-up\\s*ethtool\\s*-K\\s*eth0\\s*tx\\s*off)/\$1\$2\$3/' /usr/lib/xen-tools/gutsy.d/40-setup-networking"
132
+ else
133
+ sudo "perl -p -i -e 's/^(\\s*)(post-up\\s*ethtool\\s*-K\\s*eth0\\s*tx\\s*off)/#\$1\$2/' /usr/lib/xen-tools/gutsy.d/40-setup-networking"
134
+ end
96
135
  end
97
136
 
98
137
  end