system-builder 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -3,6 +3,7 @@ Manifest.txt
3
3
  PostInstall.txt
4
4
  README.rdoc
5
5
  Rakefile
6
+ bin/box
6
7
  bin/system-builder
7
8
  examples/Rakefile
8
9
  examples/config.rb
data/bin/box ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+
5
+ OptionParser.new do |opts|
6
+ opts.banner = <<-BANNER.gsub(/^ /,'')
7
+ Box : manage box
8
+
9
+ Usage: #{File.basename($0)} boot [options]
10
+
11
+ Options are:
12
+ BANNER
13
+ opts.separator ""
14
+ opts.on("-r", "--root=disk|iso", String,
15
+ "The support used to boot") { |arg| @root = arg }
16
+ opts.on("-h", "--help",
17
+ "Show this help message.") { puts opts; exit }
18
+ opts.parse!(ARGV)
19
+
20
+ @command = ARGV.shift
21
+
22
+ unless @command == "boot"
23
+ puts opts; exit
24
+ end
25
+ end
26
+
27
+ qemu_options = []
28
+
29
+ qemu_disks = []
30
+
31
+ case @root
32
+ when "iso"
33
+ qemu_options << "-cdrom dist/iso"
34
+ else
35
+ qemu_disks << "dist/disk"
36
+ end
37
+
38
+ if File.exists?("dist/storage")
39
+ qemu_disks << "dist/storage"
40
+ qemu_options << "--boot order=d"
41
+ end
42
+
43
+ qemu_disks.each_with_index do |disk, index|
44
+ qemu_options << "-drive file=#{disk},if=ide,index=#{index+1},media=disk"
45
+ end
46
+
47
+ qemu_options << "-net nic -net vde,sock=/var/run/vde2/tap0.ctl"
48
+
49
+ ENV['QEMU_AUDIO_DRV']='alsa'
50
+
51
+ qemu_command = "qemu -enable-kvm -m 512m -soundhw ac97 #{qemu_options.join(' ')}"
52
+
53
+ puts "Run #{qemu_command}"
54
+ system qemu_command
@@ -28,6 +28,20 @@ module SystemBuilder
28
28
  def configure(chroot)
29
29
  puts "* run puppet configuration"
30
30
 
31
+ unless chroot.image.exists?("/etc/apt/sources.list.d/lenny-backports.list")
32
+ chroot.image.open("/etc/apt/sources.list.d/lenny-backports.list") do |f|
33
+ f.puts "deb http://backports.debian.org/debian-backports lenny-backports main contrib non-free"
34
+ end
35
+
36
+ chroot.image.open("/etc/apt/preferences") do |f|
37
+ f.puts "Package: puppet"
38
+ f.puts "Pin: release a=lenny-backports"
39
+ f.puts "Pin-Priority: 999"
40
+ end
41
+
42
+ chroot.sudo "apt-get update"
43
+ end
44
+
31
45
  chroot.apt_install :puppet
32
46
  chroot.image.open("/etc/default/puppet") do |f|
33
47
  f.puts "START=no"
@@ -16,7 +16,7 @@ get_fstype() {
16
16
 
17
17
  list_devices() {
18
18
  # list partitions first
19
- (ls /dev/hd*[1-9] /dev/sd*[1-9] ; ls /dev/hd[a-z] /dev/sd[a-z]) 2> /dev/null
19
+ (ls /dev/hd*[1-9] /dev/sd*[1-9] /dev/sr[0-9]; ls /dev/hd[a-z] /dev/sd[a-z]) 2> /dev/null
20
20
  }
21
21
 
22
22
  mkdir /boot
@@ -38,4 +38,4 @@ for device in `list_devices`; do
38
38
  done
39
39
 
40
40
  echo "no image found"
41
- exit 1
41
+ exit 1
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module SystemBuilder
5
- VERSION = '0.0.16'
5
+ VERSION = '0.0.17'
6
6
 
7
7
  @@configurations = {}
8
8
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: system-builder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 63
4
+ hash: 61
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 16
10
- version: 0.0.16
9
+ - 17
10
+ version: 0.0.17
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alban Peignier
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-12 00:00:00 +02:00
18
+ date: 2010-09-14 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -54,6 +54,7 @@ description: FIX (describe your package)
54
54
  email:
55
55
  - alban@tryphon.eu
56
56
  executables:
57
+ - box
57
58
  - system-builder
58
59
  extensions: []
59
60
 
@@ -67,6 +68,7 @@ files:
67
68
  - PostInstall.txt
68
69
  - README.rdoc
69
70
  - Rakefile
71
+ - bin/box
70
72
  - bin/system-builder
71
73
  - examples/Rakefile
72
74
  - examples/config.rb