veewee 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +5 -1
  3. data/Gemfile.lock +29 -26
  4. data/README.md +51 -26
  5. data/Rakefile +41 -36
  6. data/lib/veewee/scancode.rb +1 -1
  7. data/lib/veewee/session.rb +156 -159
  8. data/lib/veewee/version.rb +1 -1
  9. data/templates/CentOS-4.8-i386/postinstall.sh +1 -1
  10. data/templates/CentOS-5.5-x86_64-netboot/definition.rb +16 -0
  11. data/templates/CentOS-5.5-x86_64-netboot/ks.cfg +46 -0
  12. data/templates/CentOS-5.5-x86_64-netboot/postinstall.sh +60 -0
  13. data/templates/CentOS-5.6-i386-netboot/definition.rb +1 -1
  14. data/templates/CentOS-5.6-i386-netboot/ks.cfg +2 -2
  15. data/templates/CentOS-5.6-i386-netboot/postinstall.sh +1 -1
  16. data/templates/CentOS-5.6-i386/postinstall.sh +1 -1
  17. data/templates/CentOS-5.6-x86_64-netboot/definition.rb +1 -1
  18. data/templates/CentOS-5.6-x86_64-netboot/ks.cfg +1 -1
  19. data/templates/CentOS-5.6-x86_64-netboot/postinstall.sh +3 -2
  20. data/templates/CentOS-5.7-i386-netboot/definition.rb +16 -0
  21. data/templates/CentOS-5.7-i386-netboot/ks.cfg +45 -0
  22. data/templates/CentOS-5.7-i386-netboot/postinstall.sh +53 -0
  23. data/templates/CentOS-5.7-x86_64-netboot/definition.rb +16 -0
  24. data/templates/CentOS-5.7-x86_64-netboot/ks.cfg +45 -0
  25. data/templates/CentOS-5.7-x86_64-netboot/postinstall.sh +60 -0
  26. data/templates/CentOS-6.0-i386-netboot/ks.cfg +1 -1
  27. data/templates/CentOS-6.0-i386-netboot/postinstall.sh +1 -1
  28. data/templates/CentOS-6.0-i386/postinstall.sh +2 -2
  29. data/templates/CentOS-6.0-x86_64-minimal/definition.rb +17 -0
  30. data/templates/CentOS-6.0-x86_64-minimal/ks.cfg +37 -0
  31. data/templates/CentOS-6.0-x86_64-minimal/postinstall.sh +50 -0
  32. data/templates/CentOS-6.0-x86_64-netboot/ks.cfg +1 -1
  33. data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +1 -1
  34. data/templates/CentOS-6.0-x86_64/postinstall.sh +2 -2
  35. data/templates/Debian-5.0.8-amd64-netboot/postinstall.sh +1 -1
  36. data/templates/Debian-5.0.8-i386-netboot/postinstall.sh +1 -1
  37. data/templates/{Debian-6.0.2-amd64-netboot → Debian-6.0.3-amd64-netboot}/definition.rb +3 -3
  38. data/templates/Debian-6.0.3-amd64-netboot/postinstall.sh +80 -0
  39. data/templates/{Debian-6.0.2-amd64-netboot → Debian-6.0.3-amd64-netboot}/preseed.cfg +0 -0
  40. data/templates/{Debian-6.0.2-i386-netboot → Debian-6.0.3-i386-netboot}/definition.rb +3 -3
  41. data/templates/{Debian-6.0.2-i386-netboot → Debian-6.0.3-i386-netboot}/postinstall.sh +2 -2
  42. data/templates/{Debian-6.0.2-i386-netboot → Debian-6.0.3-i386-netboot}/preseed.cfg +0 -0
  43. data/templates/Fedora-14-amd64-netboot/definition.rb +1 -1
  44. data/templates/Fedora-14-amd64-netboot/postinstall.sh +1 -1
  45. data/templates/Fedora-14-amd64/definition.rb +1 -1
  46. data/templates/Fedora-14-amd64/postinstall.sh +1 -1
  47. data/templates/Fedora-14-i386-netboot/postinstall.sh +1 -1
  48. data/templates/Fedora-14-i386/postinstall.sh +1 -1
  49. data/templates/Fedora-15-x86_64-netboot/definition.rb +29 -0
  50. data/templates/Fedora-15-x86_64-netboot/ks.cfg +64 -0
  51. data/templates/Fedora-15-x86_64-netboot/postinstall.sh +33 -0
  52. data/templates/Fedora-15-x86_64/definition.rb +17 -0
  53. data/templates/Fedora-15-x86_64/ks.cfg +64 -0
  54. data/templates/Fedora-15-x86_64/postinstall.sh +33 -0
  55. data/templates/archlinux-i386-netboot/aif.cfg +28 -0
  56. data/templates/archlinux-i386-netboot/definition.rb +26 -0
  57. data/templates/archlinux-i386-netboot/postinstall.sh +75 -0
  58. data/templates/archlinux-i386-netboot/postinstall2.sh +30 -0
  59. data/templates/archlinux-i386/postinstall.sh +12 -1
  60. data/templates/archlinux-x86_64-netboot/aif.cfg +28 -0
  61. data/templates/archlinux-x86_64-netboot/definition.rb +26 -0
  62. data/templates/archlinux-x86_64-netboot/postinstall.sh +75 -0
  63. data/templates/archlinux-x86_64-netboot/postinstall2.sh +30 -0
  64. data/templates/archlinux-x86_64/aif.cfg +1 -1
  65. data/templates/archlinux-x86_64/definition.rb +1 -1
  66. data/templates/archlinux-x86_64/postinstall.sh +16 -21
  67. data/templates/archlinux-x86_64/postinstall2.sh +38 -0
  68. data/templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb +2 -4
  69. data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +1 -1
  70. data/templates/freebsd-8.2-pcbsd-i386/definition.rb +3 -2
  71. data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +1 -1
  72. data/templates/gentoo-latest-i386-experimental/definition.rb +4 -4
  73. data/templates/gentoo-latest-i386-experimental/postinstall.sh +1 -1
  74. data/templates/openSUSE-11.4-DVD-i586/autoinst_de.xml +1284 -0
  75. data/templates/openSUSE-11.4-DVD-i586/autoinst_en.xml +1284 -0
  76. data/templates/openSUSE-11.4-DVD-i586/definition.rb +28 -0
  77. data/templates/openSUSE-11.4-DVD-i586/postinstall.sh +43 -0
  78. data/templates/openSUSE-11.4-DVD-x86_64/autoinst_de.xml +1459 -0
  79. data/templates/openSUSE-11.4-DVD-x86_64/autoinst_en.xml +1459 -0
  80. data/templates/openSUSE-11.4-DVD-x86_64/definition.rb +28 -0
  81. data/templates/openSUSE-11.4-DVD-x86_64/postinstall.sh +43 -0
  82. data/templates/openSUSE-11.4-NET-i586/autoinst_de.xml +1278 -0
  83. data/templates/openSUSE-11.4-NET-i586/autoinst_en.xml +1278 -0
  84. data/templates/openSUSE-11.4-NET-i586/definition.rb +28 -0
  85. data/templates/openSUSE-11.4-NET-i586/postinstall.sh +43 -0
  86. data/templates/openSUSE-11.4-NET-x86_64/autoinst_de.xml +1453 -0
  87. data/templates/openSUSE-11.4-NET-x86_64/autoinst_en.xml +1453 -0
  88. data/templates/openSUSE-11.4-NET-x86_64/definition.rb +28 -0
  89. data/templates/openSUSE-11.4-NET-x86_64/postinstall.sh +43 -0
  90. data/templates/openindiana-148-ai-x86/postinstall.sh +1 -1
  91. data/templates/opensuse-11.4-i386-experimental/postinstall.sh +1 -1
  92. data/templates/scientificlinux-6.1-i386-netboot/definition.rb +16 -0
  93. data/templates/scientificlinux-6.1-i386-netboot/ks.cfg +53 -0
  94. data/templates/scientificlinux-6.1-i386-netboot/postinstall.sh +30 -0
  95. data/templates/scientificlinux-6.1-x86_64-netboot/definition.rb +16 -0
  96. data/templates/scientificlinux-6.1-x86_64-netboot/ks.cfg +53 -0
  97. data/templates/scientificlinux-6.1-x86_64-netboot/postinstall.sh +30 -0
  98. data/templates/solaris-11-express-i386/postinstall.sh +1 -1
  99. data/templates/ubuntu-10.04.2-amd64-netboot/postinstall.sh +1 -1
  100. data/templates/ubuntu-10.04.2-server-i386-netboot/postinstall.sh +1 -1
  101. data/templates/{ubuntu-10.04.2-server-amd64-alt → ubuntu-10.04.3-server-amd64-alt}/definition.rb +4 -4
  102. data/templates/{ubuntu-10.04.2-server-amd64-alt → ubuntu-10.04.3-server-amd64-alt}/postinstall.sh +1 -1
  103. data/templates/{ubuntu-10.04.2-server-amd64-alt → ubuntu-10.04.3-server-amd64-alt}/preseed.cfg +0 -0
  104. data/templates/{ubuntu-10.04.2-server-amd64 → ubuntu-10.04.3-server-amd64}/definition.rb +3 -6
  105. data/templates/{ubuntu-10.04.2-server-amd64 → ubuntu-10.04.3-server-amd64}/postinstall.sh +1 -1
  106. data/templates/{ubuntu-10.04.2-server-amd64 → ubuntu-10.04.3-server-amd64}/preseed.cfg +0 -0
  107. data/templates/{ubuntu-10.04.2-server-i386 → ubuntu-10.04.3-server-i386}/definition.rb +4 -4
  108. data/templates/{ubuntu-10.04.2-server-i386 → ubuntu-10.04.3-server-i386}/postinstall.sh +1 -1
  109. data/templates/{ubuntu-10.04.2-server-i386 → ubuntu-10.04.3-server-i386}/preseed.cfg +0 -0
  110. data/templates/ubuntu-10.10-server-amd64-netboot/postinstall.sh +1 -1
  111. data/templates/ubuntu-10.10-server-amd64/postinstall.sh +1 -1
  112. data/templates/ubuntu-10.10-server-i386-netboot/postinstall.sh +1 -1
  113. data/templates/ubuntu-10.10-server-i386/postinstall.sh +1 -1
  114. data/templates/ubuntu-11.04-server-amd64/postinstall.sh +7 -1
  115. data/templates/ubuntu-11.04-server-i386/definition.rb +1 -1
  116. data/templates/ubuntu-11.04-server-i386/postinstall.sh +1 -1
  117. data/templates/ubuntu-11.10-server-amd64-ishaya/definition.rb +24 -0
  118. data/templates/{Debian-6.0.2-amd64-netboot → ubuntu-11.10-server-amd64-ishaya}/postinstall.sh +42 -23
  119. data/templates/ubuntu-11.10-server-amd64-ishaya/preseed.cfg +87 -0
  120. data/templates/ubuntu-11.10-server-amd64-ruby192/definition.rb +24 -0
  121. data/templates/ubuntu-11.10-server-amd64-ruby192/postinstall.sh +90 -0
  122. data/templates/ubuntu-11.10-server-amd64-ruby192/preseed.cfg +87 -0
  123. data/templates/ubuntu-11.10-server-amd64/definition.rb +35 -0
  124. data/templates/ubuntu-11.10-server-amd64/postinstall.sh +88 -0
  125. data/templates/ubuntu-11.10-server-amd64/preseed.cfg +87 -0
  126. data/templates/ubuntu-11.10-server-i386/definition.rb +35 -0
  127. data/templates/ubuntu-11.10-server-i386/postinstall.sh +88 -0
  128. data/templates/ubuntu-11.10-server-i386/preseed.cfg +87 -0
  129. data/templates/ubuntu-8.04.4-server-amd64/definition.rb +1 -0
  130. data/templates/ubuntu-8.04.4-server-amd64/postinstall.sh +8 -7
  131. data/templates/ubuntu-8.04.4-server-amd64/preseed.cfg +0 -1
  132. data/templates/ubuntu-8.04.4-server-i386/postinstall.sh +25 -3
  133. data/templates/windows-2008R2-amd64/postinstall.sh +1 -1
  134. data/validation/features/steps/ssh_steps.rb +1 -1
  135. data/validation/vagrant.feature +35 -35
  136. data/veewee.gemspec +6 -6
  137. metadata +109 -103
data/.gitignore CHANGED
@@ -5,6 +5,7 @@ tmp/*
5
5
  definitions/*
6
6
  Vagrantfile
7
7
  cookbooks/*
8
+ manifests/*
8
9
  boxes/*
9
10
  pkg/*
10
11
  *.box
data/Gemfile CHANGED
@@ -2,4 +2,8 @@ source "http://rubygems.org"
2
2
 
3
3
  gem "veewee", :path => "."
4
4
 
5
- #gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
5
+ group :test do
6
+ gem "rake"
7
+ end
8
+
9
+ gemspec
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- veewee (0.2.0)
4
+ veewee (0.2.1)
5
5
  cucumber (~> 1.0.2)
6
6
  highline (~> 1.6.1)
7
7
  net-ssh (~> 2.1.0)
8
8
  popen4 (~> 0.1.2)
9
9
  progressbar
10
- rspec (~> 2.5.0)
10
+ rspec (~> 2.5)
11
11
  thor (~> 0.14.6)
12
- vagrant (~> 0.8.0)
12
+ vagrant (~> 0.8.2)
13
13
 
14
14
  GEM
15
15
  remote: http://rubygems.org/
@@ -17,52 +17,55 @@ GEM
17
17
  Platform (0.4.0)
18
18
  archive-tar-minitar (0.5.2)
19
19
  builder (3.0.0)
20
- cucumber (1.0.2)
20
+ cucumber (1.0.6)
21
21
  builder (>= 2.1.2)
22
22
  diff-lcs (>= 1.1.2)
23
- gherkin (~> 2.4.5)
23
+ gherkin (~> 2.4.18)
24
24
  json (>= 1.4.6)
25
- term-ansicolor (>= 1.0.5)
26
- diff-lcs (1.1.2)
25
+ term-ansicolor (>= 1.0.6)
26
+ diff-lcs (1.1.3)
27
27
  erubis (2.7.0)
28
- ffi (1.0.9)
29
- gherkin (2.4.5)
28
+ ffi (1.0.11)
29
+ gherkin (2.4.21)
30
30
  json (>= 1.4.6)
31
- highline (1.6.2)
32
- i18n (0.5.0)
33
- json (1.5.3)
31
+ highline (1.6.8)
32
+ i18n (0.6.0)
33
+ json (1.5.4)
34
34
  net-scp (1.0.4)
35
35
  net-ssh (>= 1.99.1)
36
36
  net-ssh (2.1.4)
37
- open4 (1.1.0)
37
+ open4 (1.3.0)
38
38
  popen4 (0.1.2)
39
39
  Platform (>= 0.4.0)
40
40
  open4 (>= 0.4.0)
41
- progressbar (0.9.1)
42
- rspec (2.5.0)
43
- rspec-core (~> 2.5.0)
44
- rspec-expectations (~> 2.5.0)
45
- rspec-mocks (~> 2.5.0)
46
- rspec-core (2.5.2)
47
- rspec-expectations (2.5.0)
41
+ progressbar (0.9.2)
42
+ rake (0.9.2.2)
43
+ rspec (2.7.0)
44
+ rspec-core (~> 2.7.0)
45
+ rspec-expectations (~> 2.7.0)
46
+ rspec-mocks (~> 2.7.0)
47
+ rspec-core (2.7.1)
48
+ rspec-expectations (2.7.0)
48
49
  diff-lcs (~> 1.1.2)
49
- rspec-mocks (2.5.0)
50
- term-ansicolor (1.0.6)
50
+ rspec-mocks (2.7.0)
51
+ term-ansicolor (1.0.7)
51
52
  thor (0.14.6)
52
- vagrant (0.8.1)
53
+ vagrant (0.8.7)
53
54
  archive-tar-minitar (= 0.5.2)
54
55
  erubis (~> 2.7.0)
55
- i18n (~> 0.5.0)
56
+ i18n (~> 0.6.0)
56
57
  json (~> 1.5.1)
57
58
  net-scp (~> 1.0.4)
58
59
  net-ssh (~> 2.1.4)
59
60
  thor (~> 0.14.6)
60
- virtualbox (~> 0.9.0)
61
- virtualbox (0.9.0)
61
+ virtualbox (~> 0.9.1)
62
+ virtualbox (0.9.2)
62
63
  ffi (~> 1.0.9)
63
64
 
64
65
  PLATFORMS
65
66
  ruby
66
67
 
67
68
  DEPENDENCIES
69
+ bundler (>= 1.0.0)
70
+ rake
68
71
  veewee!
data/README.md CHANGED
@@ -32,39 +32,64 @@ If you don't use rvm, be sure to execute vagrant through bundle exec
32
32
 
33
33
  $ vagrant basebox templates
34
34
  The following templates are available:
35
- vagrant basebox define '<boxname>' 'ubuntu-10.10-server-i386-netboot'
36
- vagrant basebox define '<boxname>' 'ubuntu-10.10-server-amd64-netboot'
37
- vagrant basebox define '<boxname>' 'solaris-11-express-i386'
38
- vagrant basebox define '<boxname>' 'freebsd-8.2-pcbsd-i386-netboot'
35
+ vagrant basebox define '<boxname>' 'CentOS-4.8-i386'
36
+ vagrant basebox define '<boxname>' 'CentOS-5.5-x86_64-netboot'
37
+ vagrant basebox define '<boxname>' 'CentOS-5.6-i386'
38
+ vagrant basebox define '<boxname>' 'CentOS-5.6-i386-netboot'
39
+ vagrant basebox define '<boxname>' 'CentOS-5.6-x86_64-netboot'
40
+ vagrant basebox define '<boxname>' 'CentOS-5.7-i386-netboot'
41
+ vagrant basebox define '<boxname>' 'CentOS-5.7-x86_64-netboot'
42
+ vagrant basebox define '<boxname>' 'CentOS-6.0-i386'
43
+ vagrant basebox define '<boxname>' 'CentOS-6.0-i386-netboot'
44
+ vagrant basebox define '<boxname>' 'CentOS-6.0-x86_64'
45
+ vagrant basebox define '<boxname>' 'CentOS-6.0-x86_64-minimal'
46
+ vagrant basebox define '<boxname>' 'CentOS-6.0-x86_64-netboot'
47
+ vagrant basebox define '<boxname>' 'Debian-5.0.8-amd64-netboot'
48
+ vagrant basebox define '<boxname>' 'Debian-5.0.8-i386-netboot'
49
+ vagrant basebox define '<boxname>' 'Debian-6.0.2-amd64-netboot'
50
+ vagrant basebox define '<boxname>' 'Debian-6.0.2-i386-netboot'
51
+ vagrant basebox define '<boxname>' 'Debian-6.0.3-amd64-netboot'
52
+ vagrant basebox define '<boxname>' 'Debian-6.0.3-i386-netboot'
53
+ vagrant basebox define '<boxname>' 'Fedora-14-amd64'
39
54
  vagrant basebox define '<boxname>' 'Fedora-14-amd64-netboot'
40
- vagrant basebox define '<boxname>' 'ubuntu-11.04-server-amd64'
55
+ vagrant basebox define '<boxname>' 'Fedora-14-i386'
56
+ vagrant basebox define '<boxname>' 'Fedora-14-i386-netboot'
57
+ vagrant basebox define '<boxname>' 'Fedora-15-i386'
58
+ vagrant basebox define '<boxname>' 'Fedora-15-i386-netboot'
59
+ vagrant basebox define '<boxname>' 'Fedora-15-x86_64'
60
+ vagrant basebox define '<boxname>' 'Fedora-15-x86_64-netboot'
61
+ vagrant basebox define '<boxname>' 'Sysrescuecd-2.0.0-experimental'
62
+ vagrant basebox define '<boxname>' 'archlinux-i386'
63
+ vagrant basebox define '<boxname>' 'archlinux-i386-netboot'
64
+ vagrant basebox define '<boxname>' 'archlinux-x86_64'
65
+ vagrant basebox define '<boxname>' 'archlinux-x86_64-netboot'
41
66
  vagrant basebox define '<boxname>' 'freebsd-8.2-experimental'
42
- vagrant basebox define '<boxname>' 'archlinux-i686'
43
- vagrant basebox define '<boxname>' 'CentOS-5.6-i386-netboot'
67
+ vagrant basebox define '<boxname>' 'freebsd-8.2-pcbsd-i386'
68
+ vagrant basebox define '<boxname>' 'freebsd-8.2-pcbsd-i386-netboot'
69
+ vagrant basebox define '<boxname>' 'gentoo-latest-i386-experimental'
70
+ vagrant basebox define '<boxname>' 'openSUSE-11.4-DVD-i586'
71
+ vagrant basebox define '<boxname>' 'openSUSE-11.4-DVD-x86_64'
72
+ vagrant basebox define '<boxname>' 'openSUSE-11.4-NET-i586'
73
+ vagrant basebox define '<boxname>' 'openSUSE-11.4-NET-x86_64'
44
74
  vagrant basebox define '<boxname>' 'openindiana-148-ai-x86'
45
- vagrant basebox define '<boxname>' 'ubuntu-10.10-server-i386'
46
- vagrant basebox define '<boxname>' 'ubuntu-10.04.2-server-i386'
75
+ vagrant basebox define '<boxname>' 'opensuse-11.4-i386-experimental'
76
+ vagrant basebox define '<boxname>' 'solaris-11-express-i386'
47
77
  vagrant basebox define '<boxname>' 'ubuntu-10.04.2-amd64-netboot'
48
- vagrant basebox define '<boxname>' 'Sysrescuecd-2.0.0-experimental'
49
- vagrant basebox define '<boxname>' 'Debian-6.0.1a-amd64-netboot'
50
- vagrant basebox define '<boxname>' 'freebsd-8.2-pcbsd-i386'
51
- vagrant basebox define '<boxname>' 'Fedora-14-i386'
52
- vagrant basebox define '<boxname>' 'Fedora-14-amd64'
53
78
  vagrant basebox define '<boxname>' 'ubuntu-10.04.2-server-i386-netboot'
54
- vagrant basebox define '<boxname>' 'opensuse-11.4-i386-experimental'
55
- vagrant basebox define '<boxname>' 'CentOS-4.8-i386'
56
- vagrant basebox define '<boxname>' 'ubuntu-10.04.2-server-amd64'
79
+ vagrant basebox define '<boxname>' 'ubuntu-10.04.3-server-amd64'
80
+ vagrant basebox define '<boxname>' 'ubuntu-10.04.3-server-amd64-alt'
81
+ vagrant basebox define '<boxname>' 'ubuntu-10.04.3-server-i386'
82
+ vagrant basebox define '<boxname>' 'ubuntu-10.10-server-amd64'
83
+ vagrant basebox define '<boxname>' 'ubuntu-10.10-server-amd64-netboot'
84
+ vagrant basebox define '<boxname>' 'ubuntu-10.10-server-i386'
85
+ vagrant basebox define '<boxname>' 'ubuntu-10.10-server-i386-netboot'
86
+ vagrant basebox define '<boxname>' 'ubuntu-11.04-server-amd64'
87
+ vagrant basebox define '<boxname>' 'ubuntu-11.04-server-i386'
88
+ vagrant basebox define '<boxname>' 'ubuntu-11.10-server-amd64'
89
+ vagrant basebox define '<boxname>' 'ubuntu-11.10-server-i386'
57
90
  vagrant basebox define '<boxname>' 'ubuntu-8.04.4-server-amd64'
58
- vagrant basebox define '<boxname>' 'gentoo-latest-i386-experimental'
59
91
  vagrant basebox define '<boxname>' 'ubuntu-8.04.4-server-i386'
60
92
  vagrant basebox define '<boxname>' 'windows-2008R2-amd64'
61
- vagrant basebox define '<boxname>' 'Fedora-14-i386-netboot'
62
- vagrant basebox define '<boxname>' 'archlinux-64-experimental'
63
- vagrant basebox define '<boxname>' 'Debian-6.0.1a-i386-netboot'
64
- vagrant basebox define '<boxname>' 'ubuntu-10.10-server-amd64'
65
- vagrant basebox define '<boxname>' 'archlinux-64-aif-experimental'
66
- vagrant basebox define '<boxname>' 'ubuntu-11.04-server-i386'
67
- vagrant basebox define '<boxname>' 'CentOS-5.6-i386'
68
93
 
69
94
 
70
95
  ## Define a new box
@@ -131,7 +156,7 @@ Put your isofile inside the 'currentdir'/iso directory or if you don't run
131
156
  - Mount the ISO File :iso_file
132
157
  - Boot up the machine and wait for :boot_time
133
158
  - Send the keystrokes in :boot_cmd_sequence
134
- - Startup a webserver on :kickstart_port to wait for a request for the :kickstart_file
159
+ - Startup a webserver on :kickstart_port to wait for a request for the :kickstart_file (don't navigate to the file in your browser or the server will stop and the installer will not be able to find your preseed)
135
160
  - Wait for ssh login to work with :ssh_user , :ssh_password
136
161
  - Sudo execute the :postinstall_files
137
162
 
data/Rakefile CHANGED
@@ -4,67 +4,72 @@ require 'bundler/setup'
4
4
  Bundler::GemHelper.install_tasks
5
5
 
6
6
  #Setup some base variables to use
7
- veewee_dir= "."
8
- definition_dir= File.expand_path(File.join(veewee_dir, "definitions"))
9
- lib_dir= File.expand_path(File.join(veewee_dir, "lib"))
10
- box_dir= File.expand_path(File.join(veewee_dir, "boxes"))
11
- template_dir=File.expand_path(File.join(veewee_dir, "templates"))
12
- vbox_dir=File.expand_path(File.join(veewee_dir, "tmp"))
13
- tmp_dir=File.expand_path(File.join(veewee_dir, "tmp"))
14
- iso_dir=File.expand_path(File.join(veewee_dir, "iso"))
7
+ veewee_dir = "."
8
+ lib_dir = File.expand_path(File.join(veewee_dir, "lib"))
9
+ box_dir = File.expand_path(File.join(veewee_dir, "boxes"))
10
+ vbox_dir = File.expand_path(File.join(veewee_dir, "tmp"))
11
+ tmp_dir = File.expand_path(File.join(veewee_dir, "tmp"))
12
+ iso_dir = File.expand_path(File.join(veewee_dir, "iso"))
13
+ definition_dir = File.expand_path(File.join(veewee_dir, "definitions"))
14
+ template_dir = File.expand_path(File.join(veewee_dir, "templates"))
15
15
 
16
16
 
17
17
  #Load Veewee::Session libraries
18
- Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f|
19
- require f }
18
+ Dir.glob(File.join(lib_dir, '**','*.rb')).each { |f| require f }
20
19
 
21
20
  #Initialize
22
- Veewee::Session.setenv({:veewee_dir => veewee_dir, :definition_dir => definition_dir,
23
- :template_dir => template_dir, :iso_dir => iso_dir, :box_dir => box_dir, :tmp_dir => tmp_dir})
21
+ Veewee::Session.setenv({
22
+ :veewee_dir => veewee_dir,
23
+ :definition_dir => definition_dir,
24
+ :template_dir => template_dir,
25
+ :iso_dir => iso_dir,
26
+ :box_dir => box_dir,
27
+ :tmp_dir => tmp_dir
28
+ })
24
29
 
25
30
  desc 'Default: list templates'
26
31
  task :default => [:templates]
27
32
 
28
33
  desc 'List templates'
29
34
  task :templates do
30
- Veewee::Session.list_templates
35
+ Veewee::Session.list_templates
31
36
  end
32
37
 
33
38
  desc 'Define box'
34
39
  task :define, [:boxname,:template_name] do |t,args|
35
- if args.to_hash.size!=2
36
- puts "needs two arguments: rake define['boxname','template_name']"
37
- exit
38
- end
39
- Veewee::Session.define(args.boxname,args.template_name)
40
+ if args.to_hash.size!=2
41
+ puts "needs two arguments: rake define['boxname','template_name']"
42
+ exit
43
+ end
44
+ Veewee::Session.define(args.boxname,args.template_name)
40
45
  end
41
46
 
42
47
  desc 'Undefine box'
43
48
  task :undefine, [:boxname] do |t,args|
44
- if args.to_hash.size!=1
45
- puts "needs one arguments: rake undefine[\"yourname\"]"
46
- exit
47
- end
48
- Veewee::Session.undefine(args.boxname)
49
+ if args.to_hash.size!=1
50
+ puts "needs one arguments: rake undefine[\"yourname\"]"
51
+ exit
52
+ end
53
+ Veewee::Session.undefine(args.boxname)
49
54
  end
50
55
 
51
56
  desc 'List Definitions'
52
- task :definitions do
53
- Veewee::Session.list_definitions
57
+ task :definitions do
58
+ Veewee::Session.list_definitions
54
59
  end
55
60
 
56
61
  desc 'Build box'
57
62
  task :build, [:boxname] do |t,args|
58
- if args.to_hash.size!=1
59
- puts "needs one arguments: rake build['boxname']"
60
- exit
61
- end
62
- Veewee::Session.build(args.boxname)
63
+ if args.to_hash.size!=1
64
+ puts "needs one arguments: rake build['boxname']"
65
+ exit
66
+ end
67
+ Veewee::Session.build(args.boxname)
63
68
  end
64
69
 
65
70
  desc 'List boxes'
66
71
  task :boxes do
67
- Veewee::Session.list_boxes
72
+ Veewee::Session.list_boxes
68
73
  end
69
74
 
70
75
  desc 'Export box'
@@ -73,20 +78,20 @@ task :export, [:boxname] do |t,args|
73
78
  puts "needs one arguments: rake export['boxname']"
74
79
  exit
75
80
  end
76
- Veewee::Session.export_box(args.boxname)
81
+ Veewee::Session.export_box(args.boxname)
77
82
  end
78
83
 
79
84
  desc 'Remove box'
80
85
  task :remove_box, [:boxname] do |t,args|
81
- Veewee::Session.remove_box(args.boxname)
86
+ Veewee::Session.remove_box(args.boxname)
82
87
  end
83
88
 
84
89
  desc 'List ostypes available'
85
90
  task :list_ostypes do |t,args|
86
- Veewee::Session.list_ostypes
91
+ Veewee::Session.list_ostypes
87
92
  end
88
93
 
89
94
  desc 'Clean all unfinished builds'
90
- task :clean do
91
- Veewee::Session.clean
95
+ task :clean do
96
+ Veewee::Session.clean
92
97
  end
@@ -67,7 +67,7 @@ module Veewee
67
67
  k['\\'] = '2b ab'; k['|'] = '2a 2b aa 8b';
68
68
 
69
69
  k['[']='1a 9a'; k[']']='1b 9b';
70
- k['<']='2a 33 aa b3'; k['>']='2a 34 aa b4';
70
+ k['<']='2a 33 aa b3'; k['>']='2a 34 aa b4'; k['?']='2a 35 aa b5';
71
71
  k['$']='2a 05 aa 85';
72
72
  k['+']='2a 0d aa 8d';
73
73
 
@@ -7,13 +7,10 @@ require 'progressbar'
7
7
  require 'highline/import'
8
8
  require 'tempfile'
9
9
  require 'virtualbox'
10
- require 'virtualbox/abstract_model'
11
- require 'virtualbox/ext/byte_normalizer'
12
-
13
10
 
14
11
  module Veewee
15
12
  class Session
16
-
13
+
17
14
  attr_accessor :veewee_dir
18
15
  attr_accessor :definition_dir
19
16
  attr_accessor :template_dir
@@ -30,10 +27,10 @@ module Veewee
30
27
  @iso_dir=env[:iso_dir]
31
28
  @tmp_dir=env[:tmp_dir]
32
29
  end
33
-
30
+
34
31
  def self.declare(options)
35
32
  defaults={
36
- :cpu_count => '1', :memory_size=> '256',
33
+ :cpu_count => '1', :memory_size=> '256',
37
34
  :disk_size => '10240', :disk_format => 'VDI', :hostiocache => 'off' ,
38
35
  :os_type_id => 'Ubuntu',
39
36
  :iso_file => "ubuntu-10.10-server-i386.iso", :iso_src => "", :iso_md5 => "", :iso_download_timeout => 1000,
@@ -44,16 +41,16 @@ module Veewee
44
41
  :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
45
42
  :shutdown_cmd => "shutdown -h now",
46
43
  :postinstall_files => [ "postinstall.sh"],:postinstall_timeout => 10000}
47
-
44
+
48
45
  @definition=defaults.merge(options)
49
-
46
+
50
47
  end
51
-
48
+
52
49
  def self.define(boxname,template_name,options = {})
53
50
  #Check if template_name exists
54
-
51
+
55
52
  options = { "force" => false, "format" => "vagrant" }.merge(options)
56
-
53
+
57
54
  if File.directory?(File.join(@template_dir,template_name))
58
55
  else
59
56
  puts "This template can not be found, use vagrant basebox templates to list all templates"
@@ -62,7 +59,7 @@ module Veewee
62
59
  if !File.exists?(@definition_dir)
63
60
  FileUtils.mkdir(@definition_dir)
64
61
  end
65
-
62
+
66
63
  if File.directory?(File.join(@definition_dir,boxname))
67
64
  if !options["force"]
68
65
  puts "The definition for #{boxname} already exists. Use --force to overwrite"
@@ -75,18 +72,18 @@ module Veewee
75
72
  puts "The basebox '#{boxname}' has been successfully created from the template ''#{template_name}'"
76
73
  puts "You can now edit the definition files stored in definitions/#{boxname}"
77
74
  puts "or build the box with:"
78
- if (options["format"]=='vagrant')
75
+ if (options["format"]=='vagrant')
79
76
  puts "vagrant basebox build '#{boxname}'"
80
77
  end
81
78
  if (options["format"]=='veewee')
82
79
  puts "veewee build '#{boxname}'"
83
80
  end
84
-
81
+
85
82
  end
86
83
 
87
84
 
88
85
 
89
-
86
+
90
87
  def self.definition_exists?(boxname)
91
88
  if File.directory?(File.join(@definition_dir,boxname))
92
89
  if File.exists?(File.join(@definition_dir,boxname,'definition.rb'))
@@ -97,7 +94,7 @@ module Veewee
97
94
  else
98
95
  return false
99
96
  end
100
-
97
+
101
98
  end
102
99
 
103
100
  def self.undefine(boxname)
@@ -114,13 +111,13 @@ module Veewee
114
111
 
115
112
  def self.list_templates( options = { :format => 'vagrant'})
116
113
  puts "The following templates are available:"
117
- subdirs=Dir.glob("#{@template_dir}/*")
114
+ subdirs=Dir.glob("#{@template_dir}/*").sort_by {|f| File.basename f}
118
115
  subdirs.each do |sub|
119
116
  if File.directory?("#{sub}")
120
117
  definition=Dir.glob("#{sub}/definition.rb")
121
118
  if definition.length!=0
122
119
  name=sub.sub(/#{@template_dir}\//,'')
123
- if (options[:format]=='vagrant')
120
+ if (options[:format]=='vagrant')
124
121
  puts "vagrant basebox define '<boxname>' '#{name}'"
125
122
  end
126
123
  if (options[:format]=='veewee')
@@ -149,7 +146,7 @@ module Veewee
149
146
 
150
147
  def self.verify_iso(filename,autodownload = false)
151
148
  if File.exists?(File.join(@iso_dir,filename))
152
- puts
149
+ puts
153
150
  puts "Verifying the isofile #{filename} is ok."
154
151
  else
155
152
 
@@ -157,7 +154,7 @@ module Veewee
157
154
  path1=Pathname.new(full_path)
158
155
  path2=Pathname.new(Dir.pwd)
159
156
  rel_path=path1.relative_path_from(path2).to_s
160
-
157
+
161
158
  puts
162
159
  puts "We did not find an isofile in <currentdir>/iso. \n\nThe definition provided the following download information:"
163
160
  unless "#{@definition[:iso_src]}"==""
@@ -166,7 +163,7 @@ module Veewee
166
163
  puts "- Md5 Checksum: #{@definition[:iso_md5]}"
167
164
  puts "#{@definition[:iso_download_instructions]}"
168
165
  puts
169
-
166
+
170
167
  if @definition[:iso_src] == ""
171
168
  puts "Please follow the instructions above:"
172
169
  puts "- to get the ISO"
@@ -175,60 +172,60 @@ module Veewee
175
172
  puts
176
173
  exit
177
174
  else
178
-
175
+
179
176
  question=ask("Download? (Yes/No)") {|q| q.default="No"}
180
177
  if question.downcase == "yes"
181
178
  if !File.exists?(@iso_dir)
182
179
  puts "Creating an iso directory"
183
180
  FileUtils.mkdir(@iso_dir)
184
181
  end
185
-
182
+
186
183
  download_progress(@definition[:iso_src],full_path)
187
184
  else
188
185
  puts "You have choosen for manual download: "
189
186
  puts "curl -C - -L '#{@definition[:iso_src]}' -o '#{rel_path}'"
190
187
  puts "md5 '#{rel_path}' "
191
- puts
188
+ puts
192
189
  exit
193
190
  end
194
-
191
+
195
192
  end
196
193
  end
197
-
194
+
198
195
  end
199
196
 
200
197
  def self.export_box(boxname)
201
198
  #Now we have to load the definition (reads definition.rb)
202
199
  load_definition(boxname)
203
-
200
+
204
201
  Veewee::Export.vagrant(boxname,@box_dir,@definition)
205
202
  #vagrant removes the mapping
206
203
  #we need to restore it in order to be able to login again
207
204
  add_ssh_nat_mapping(boxname)
208
-
205
+
209
206
  end
210
-
207
+
211
208
  def self.remove_box(boxname)
212
209
  puts "Not yet implemented"
213
210
  end
214
211
 
215
212
  def self.build(boxname,options)
216
-
213
+
217
214
  options = { "force" => false, "format" => "vagrant", "nogui" => false }.merge(options)
218
-
215
+
219
216
  #Now we have to load the definition (reads definition.rb)
220
217
  load_definition(boxname)
221
218
 
222
219
  #Command to execute locally
223
220
  @vboxcmd=determine_vboxcmd
224
-
221
+
225
222
  ssh_options={ :user => @definition[:ssh_user], :port => @definition[:ssh_host_port], :password => @definition[:ssh_password],
226
- :timeout => @definition[:ssh_timeout]}
227
-
223
+ :timeout => @definition[:ssh_timeout]}
224
+
228
225
  #Suppress those annoying virtualbox messages
229
- suppress_messages
230
-
231
-
226
+ suppress_messages
227
+
228
+
232
229
  vm=VirtualBox::VM.find(boxname)
233
230
 
234
231
  if (!vm.nil? && (vm.saved?))
@@ -236,7 +233,7 @@ module Veewee
236
233
  vm.discard_state
237
234
  vm.reload
238
235
  end
239
-
236
+
240
237
  if (!vm.nil? && !(vm.powered_off?))
241
238
  puts "Shutting down vm #{boxname}"
242
239
  #We force it here, maybe vm.shutdown is cleaner
@@ -250,32 +247,32 @@ module Veewee
250
247
  end
251
248
  sleep 3
252
249
  end
253
-
254
-
250
+
251
+
255
252
  verify_iso(@definition[:iso_file])
256
-
253
+
257
254
  if (options["force"]==false)
258
- else
255
+ else
259
256
  puts "Forcing build by destroying #{boxname} machine"
260
257
  destroy_vm(boxname)
261
258
  end
262
-
259
+
263
260
  if Veewee::Utils.is_port_open?("localhost", @definition[:ssh_host_port])
264
261
  puts "Hmm, the port #{@definition[:ssh_host_port]} is open. And we shut down?"
265
262
  exit
266
263
  end
267
-
264
+
268
265
  checksums=calculate_checksums(@definition,boxname)
269
-
266
+
270
267
  transaction(boxname,"0-initial-#{checksums[0]}",checksums) do
271
-
268
+
272
269
  #Create the Virtualmachine and set all the memory and other stuff
273
270
  create_vm(boxname)
274
-
271
+
275
272
  #Create a disk with the same name as the boxname
276
273
  create_disk(boxname)
277
-
278
-
274
+
275
+
279
276
  #These command actually call the commandline of Virtualbox, I hope to use the virtualbox-ruby library in the future
280
277
  add_ide_controller(boxname)
281
278
  add_sata_controller(boxname)
@@ -290,13 +287,13 @@ module Veewee
290
287
  else
291
288
  start_vm(boxname,"gui")
292
289
  end
293
-
290
+
294
291
  #waiting for it to boot
295
292
  puts "Waiting for the machine to boot"
296
293
  sleep @definition[:boot_wait].to_i
297
-
294
+
298
295
  Veewee::Scancode.send_sequence("#{@vboxcmd}","#{boxname}",@definition[:boot_cmd_sequence],@definition[:kickstart_port])
299
-
296
+
300
297
  kickstartfile=@definition[:kickstart_file]
301
298
  if kickstartfile.nil? || kickstartfile.length == 0
302
299
  puts "Skipping webserver as no kickstartfile was specified"
@@ -307,7 +304,7 @@ module Veewee
307
304
  Veewee::Web.wait_for_request(kickstartfile,{:port => @definition[:kickstart_port],
308
305
  :host => @definition[:kickstart_ip], :timeout => @definition[:kickstart_timeout],
309
306
  :web_dir => File.join(@definition_dir,boxname)})
310
- end
307
+ end
311
308
  if kickstartfile.is_a? Array
312
309
  kickstartfiles=kickstartfile
313
310
  kickstartfiles.each do |kickfile|
@@ -317,10 +314,10 @@ module Veewee
317
314
  end
318
315
  end
319
316
  end
320
-
321
-
317
+
318
+
322
319
  Veewee::Ssh.when_ssh_login_works("localhost",ssh_options) do
323
- #Transfer version of Virtualbox to $HOME/.vbox_version
320
+ #Transfer version of Virtualbox to $HOME/.vbox_version
324
321
  versionfile=Tempfile.open("vbox.version")
325
322
  versionfile.puts "#{VirtualBox::Global.global.lib.virtualbox.version.split('_')[0]}"
326
323
  versionfile.rewind
@@ -335,16 +332,16 @@ module Veewee
335
332
  versionfile.delete
336
333
  end
337
334
  end #initial Transaction
338
-
339
-
335
+
336
+
340
337
  counter=1
341
338
  @definition[:postinstall_files].each do |postinstall_file|
342
-
343
-
344
- filename=File.join(@definition_dir,boxname,postinstall_file)
345
-
339
+
340
+
341
+ filename=File.join(@definition_dir,boxname,postinstall_file)
342
+
346
343
  transaction(boxname,"#{counter}-#{postinstall_file}-#{checksums[counter]}",checksums) do
347
-
344
+
348
345
  Veewee::Ssh.when_ssh_login_works("localhost",ssh_options) do
349
346
  begin
350
347
  Veewee::Ssh.transfer_file("localhost",filename,File.basename(filename),ssh_options)
@@ -359,30 +356,30 @@ module Veewee
359
356
  puts "***#{newcommand}"
360
357
  Veewee::Ssh.execute("localhost","#{newcommand}",ssh_options)
361
358
  end
362
-
359
+
363
360
  end
364
361
  counter+=1
365
-
366
- end
367
-
362
+
363
+ end
364
+
368
365
  puts "#{boxname} was built successfully. "
369
366
  puts ""
370
367
  puts "Now you can: "
371
368
  puts "- verify your box by running : vagrant basebox validate #{boxname}"
372
369
  puts "- export your vm to a .box file by running : vagrant basebox export #{boxname}"
373
-
370
+
374
371
  end
375
372
 
376
-
373
+
377
374
  def self.determine_vboxcmd
378
375
  return "VBoxManage"
379
376
  end
380
-
377
+
381
378
  def self.start_vm(boxname,mode)
382
379
  vm=VirtualBox::VM.find(boxname)
383
380
  vm.start(mode)
384
381
  end
385
-
382
+
386
383
  def self.load_definition(boxname)
387
384
 
388
385
  if definition_exists?(boxname)
@@ -392,14 +389,14 @@ module Veewee
392
389
  rescue LoadError
393
390
  puts "Error loading definition of #{boxname}"
394
391
  exit
395
- end
392
+ end
396
393
  else
397
394
  puts "Error: definition for basebox '#{boxname}' does not exist."
398
395
  list_definitions
399
396
  exit
400
397
  end
401
398
  end
402
-
399
+
403
400
  def self.add_ssh_nat_mapping(boxname)
404
401
  vm=VirtualBox::VM.find(boxname)
405
402
  #Map SSH Ports
@@ -410,24 +407,24 @@ module Veewee
410
407
  port.hostport = @definition[:ssh_host_port].to_i
411
408
  vm.network_adapters[0].nat_driver.forwarded_ports << port
412
409
  port.save
413
- vm.save
410
+ vm.save
414
411
  end
415
-
412
+
416
413
  def self.destroy_vm(boxname)
417
-
414
+
418
415
  load_definition(boxname)
419
- @vboxcmd=determine_vboxcmd
416
+ @vboxcmd=determine_vboxcmd
420
417
  #:destroy_medium => :delete, will delete machine + all media attachments
421
418
  #vm.destroy(:destroy_medium => :delete)
422
419
  ##vm.destroy(:destroy_image => true)
423
-
420
+
424
421
  #VBoxManage unregistervm "test-machine" --delete
425
422
  #because the destroy does remove the .vbox file on 4.0.x
426
423
  #PDB
427
424
  #vm.destroy()
428
-
429
-
430
-
425
+
426
+
427
+
431
428
  vm=VirtualBox::VM.find(boxname)
432
429
 
433
430
  if (!vm.nil? && !(vm.powered_off?))
@@ -441,50 +438,50 @@ module Veewee
441
438
  exit
442
439
  end
443
440
  sleep 3
444
- end
441
+ end
442
+
445
443
 
446
-
447
- command="#{@vboxcmd} unregistervm '#{boxname}' --delete"
444
+ command="#{@vboxcmd} unregistervm '#{boxname}' --delete"
448
445
  puts command
449
446
  puts "Deleting vm #{boxname}"
450
-
447
+
451
448
  #Exec and system stop the execution here
452
449
  Veewee::Shell.execute("#{command}")
453
450
  sleep 1
454
-
451
+
455
452
  #if the disk was not attached when the machine was destroyed we also need to delete the disk
456
453
  location=boxname+"."+@definition[:disk_format].downcase
457
- found=false
454
+ found=false
458
455
  VirtualBox::HardDrive.all.each do |d|
459
456
  if d.location.match(/#{location}/)
460
-
461
- if File.exists?(d.location)
457
+
458
+ if File.exists?(d.location)
462
459
  command="#{@vboxcmd} closemedium disk '#{d.location}' --delete"
463
460
  else
464
- command="#{@vboxcmd} closemedium disk '#{d.location}'"
461
+ command="#{@vboxcmd} closemedium disk '#{d.location}'"
465
462
  end
466
-
463
+
467
464
  #command="#{@vboxcmd} closemedium disk '#{d.location}' --delete"
468
465
  puts "Deleting disk #{d.location}"
469
466
  puts "#{command}"
470
467
 
471
- Veewee::Shell.execute("#{command}")
472
-
473
- if File.exists?(d.location)
468
+ Veewee::Shell.execute("#{command}")
469
+
470
+ if File.exists?(d.location)
474
471
  puts "We tried to delete the disk file via virtualbox '#{d.location} but failed"
475
472
  puts "Removing it manually"
476
473
  FileUtils.rm(d.location)
477
474
  exit
478
- end
475
+ end
479
476
  #v.3
480
477
  #d.destroy(true)
481
478
  break
482
479
  end
483
- end
480
+ end
484
481
  end
485
-
482
+
486
483
  def self.create_vm(boxname,force=false)
487
-
484
+
488
485
  #Verifying the os.id with the :os_type_id specified
489
486
  matchfound=false
490
487
  VirtualBox::Global.global.lib.virtualbox.guest_os_types.collect { |os|
@@ -504,9 +501,9 @@ module Veewee
504
501
  puts "shutting down box"
505
502
  #We force it here, maybe vm.shutdown is cleaner
506
503
  vm.stop
507
- end
504
+ end
508
505
 
509
- if !vm.nil?
506
+ if !vm.nil?
510
507
  puts "Box already exists"
511
508
  #vm.stop
512
509
  #vm.destroy
@@ -521,7 +518,7 @@ module Veewee
521
518
 
522
519
  # Modify the vm to enable or disable hw virtualization extensions
523
520
  vm_flags=%w{pagefusion acpi ioapic pae hpet hwvirtex hwvirtexcl nestedpaging largepages vtxvpid synthxcpu rtcuseutc}
524
-
521
+
525
522
  vm_flags.each do |vm_flag|
526
523
  unless @definition[vm_flag.to_sym].nil?
527
524
  puts "Setting VM Flag #{vm_flag} to #{@definition[vm_flag.to_sym]}"
@@ -532,7 +529,7 @@ module Veewee
532
529
 
533
530
  # Todo Check for java
534
531
  # Todo check output of commands
535
-
532
+
536
533
  # Check for floppy
537
534
  unless @definition[:floppy_files].nil?
538
535
  require 'tmpdir'
@@ -546,20 +543,20 @@ module Veewee
546
543
  command="java -jar #{javacode_dir}/dir2floppy.jar '#{temp_dir}' '#{floppy_file}'"
547
544
  puts "#{command}"
548
545
  Veewee::Shell.execute("#{command}")
549
-
546
+
550
547
  # Create floppy controller
551
548
  command="#{@vboxcmd} storagectl '#{boxname}' --name 'Floppy Controller' --add floppy"
552
549
  puts "#{command}"
553
550
  Veewee::Shell.execute("#{command}")
554
-
551
+
555
552
  # Attach floppy to machine (the vfd extension is crucial to detect msdos type floppy)
556
553
  command="#{@vboxcmd} storageattach '#{boxname}' --storagectl 'Floppy Controller' --port 0 --device 0 --type fdd --medium '#{floppy_file}'"
557
554
  puts "#{command}"
558
- Veewee::Shell.execute("#{command}")
559
-
555
+ Veewee::Shell.execute("#{command}")
556
+
560
557
  end
561
-
562
-
558
+
559
+
563
560
  #Exec and system stop the execution here
564
561
  Veewee::Shell.execute("#{command}")
565
562
 
@@ -575,43 +572,43 @@ module Veewee
575
572
  puts "but now it's gone"
576
573
  exit
577
574
  end
578
-
579
- #Set all params we know
575
+
576
+ #Set all params we know
580
577
  vm.memory_size=@definition[:memory_size].to_i
581
578
  vm.os_type_id=@definition[:os_type_id]
582
579
  vm.cpu_count=@definition[:cpu_count].to_i
583
580
  vm.name=boxname
584
581
 
585
582
  puts "Creating vm #{vm.name} : #{vm.memory_size}M - #{vm.cpu_count} CPU - #{vm.os_type_id}"
586
- #setting bootorder
583
+ #setting bootorder
587
584
  vm.boot_order[0]=:hard_disk
588
585
  vm.boot_order[1]=:dvd
589
586
  vm.boot_order[2]=:null
590
587
  vm.boot_order[3]=:null
591
588
  vm.validate
592
589
  vm.save
593
-
590
+
594
591
  end
595
-
592
+
596
593
  def self.create_disk(boxname)
597
594
  #Now check the disks
598
595
  #Maybe one day we can use the name, now we have to check location
599
596
  #disk=VirtualBox::HardDrive.find(boxname)
600
597
  location=boxname+"."+@definition[:disk_format].downcase
601
-
602
- found=false
598
+
599
+ found=false
603
600
  VirtualBox::HardDrive.all.each do |d|
604
601
  if !d.location.match(/#{location}/).nil?
605
602
  found=true
606
603
  break
607
604
  end
608
- end
605
+ end
609
606
 
610
607
  @vboxcmd=determine_vboxcmd
611
-
608
+
612
609
  if !found
613
610
  puts "Creating new harddrive of size #{@definition[:disk_size].to_i} "
614
-
611
+
615
612
  #newdisk=VirtualBox::HardDrive.new
616
613
  #newdisk.format=@definition[:disk_format]
617
614
  #newdisk.logical_size=@definition[:disk_size].to_i
@@ -620,38 +617,38 @@ module Veewee
620
617
  ##PDB: again problems with the virtualbox GEM
621
618
  ##VirtualBox::Global.global.max_vdi_size=1000000
622
619
  #newdisk.save
623
-
620
+
624
621
  command="#{@vboxcmd} list systemproperties|grep '^Default machine'|cut -d ':' -f 2|sed -e 's/^[ ]*//'"
625
622
  results=IO.popen("#{command}")
626
623
  place=results.gets.chop
627
624
  results.close
628
-
625
+
629
626
  command ="#{@vboxcmd} createhd --filename '#{place}/#{boxname}/#{boxname}.#{@definition[:disk_format].downcase}' --size '#{@definition[:disk_size].to_i}' --format #{@definition[:disk_format].downcase} > /dev/null"
630
627
  puts "#{command}"
631
628
  Veewee::Shell.execute("#{command}")
632
-
629
+
633
630
  end
634
-
631
+
635
632
  end
636
-
633
+
637
634
  def self.add_ide_controller(boxname)
638
635
  #unless => "${vboxcmd} showvminfo '${vname}' | grep 'IDE Controller' "
639
636
  command ="#{@vboxcmd} storagectl '#{boxname}' --name 'IDE Controller' --add ide"
640
637
  Veewee::Shell.execute("#{command}")
641
638
  end
642
-
639
+
643
640
  def self.add_sata_controller(boxname)
644
641
  #unless => "${vboxcmd} showvminfo '${vname}' | grep 'SATA Controller' ";
645
- command ="#{@vboxcmd} storagectl '#{boxname}' --name 'SATA Controller' --add sata --hostiocache #{@definition[:hostiocache]}"
642
+ command ="#{@vboxcmd} storagectl '#{boxname}' --name 'SATA Controller' --add sata --sataportcount 1 --hostiocache #{@definition[:hostiocache]}"
646
643
  Veewee::Shell.execute("#{command}")
647
644
  end
648
-
649
-
645
+
646
+
650
647
  def self.attach_disk(boxname)
651
648
  location=boxname+"."+@definition[:disk_format].downcase
652
-
649
+
653
650
  @vboxcmd=determine_vboxcmd
654
-
651
+
655
652
  command="#{@vboxcmd} list systemproperties|grep '^Default machine'|cut -d ':' -f 2|sed -e 's/^[ ]*//'"
656
653
  results=IO.popen("#{command}")
657
654
  place=results.gets.chop
@@ -659,13 +656,13 @@ module Veewee
659
656
 
660
657
  location="#{place}/#{boxname}/"+location
661
658
  puts "Attaching disk: #{location}"
662
-
659
+
663
660
  #command => "${vboxcmd} storageattach '${vname}' --storagectl 'SATA Controller' --port 0 --device 0 --type hdd --medium '${vname}.vdi'",
664
661
  command ="#{@vboxcmd} storageattach '#{boxname}' --storagectl 'SATA Controller' --port 0 --device 0 --type hdd --medium '#{location}'"
665
662
  Veewee::Shell.execute("#{command}")
666
663
 
667
664
  end
668
-
665
+
669
666
  def self.mount_isofile(boxname,isofile)
670
667
  full_iso_file=File.join(@iso_dir,isofile)
671
668
  puts "Mounting cdrom: #{full_iso_file}"
@@ -673,9 +670,9 @@ module Veewee
673
670
  command ="#{@vboxcmd} storageattach '#{boxname}' --storagectl 'IDE Controller' --type dvddrive --port 1 --device 0 --medium '#{full_iso_file}'"
674
671
  Veewee::Shell.execute("#{command}")
675
672
  end
676
-
677
-
678
-
673
+
674
+
675
+
679
676
  def self.suppress_messages
680
677
  #Setting this annoying messages to register
681
678
  VirtualBox::ExtraData.global["GUI/RegistrationData"]="triesLeft=0"
@@ -684,7 +681,7 @@ module Veewee
684
681
  VirtualBox::ExtraData.global["GUI/UpdateCheckCount"]="60"
685
682
  update_date=Time.now+86400
686
683
  VirtualBox::ExtraData.global["GUI/UpdateDate"]="1 d, #{update_date.year}-#{update_date.month}-#{update_date.day}, stable"
687
-
684
+
688
685
  VirtualBox::ExtraData.global.save
689
686
  end
690
687
 
@@ -698,7 +695,7 @@ module Veewee
698
695
  ensure
699
696
  Socket.do_not_reverse_lookup = orig
700
697
  end
701
-
698
+
702
699
  def self.validate_box(boxname,options)
703
700
  require 'cucumber'
704
701
 
@@ -725,16 +722,16 @@ module Veewee
725
722
  end
726
723
 
727
724
  end
728
-
725
+
729
726
  def self.list_ostypes
730
727
  puts
731
728
  puts "Available os types:"
732
729
  VirtualBox::Global.global.lib.virtualbox.guest_os_types.collect { |os|
733
730
  puts "#{os.id}: #{os.description}"
734
- }
731
+ }
735
732
  end
736
-
737
-
733
+
734
+
738
735
  def self.calculate_checksums(definition,boxname)
739
736
 
740
737
  #TODO: get rid of definitiondir and so one
@@ -752,7 +749,7 @@ module Veewee
752
749
  unless postinstall_files.nil?
753
750
  for filename in postinstall_files
754
751
  begin
755
- full_filename=File.join(@definition_dir,boxname,filename)
752
+ full_filename=File.join(@definition_dir,boxname,filename)
756
753
 
757
754
  checksums << Digest::MD5.hexdigest(File.read(full_filename))
758
755
  rescue
@@ -782,14 +779,14 @@ module Veewee
782
779
  dst.write(src.read)
783
780
  }
784
781
  }
785
-
782
+
786
783
  end
787
-
784
+
788
785
  def self.transaction(boxname,step_name,checksums,&block)
789
786
 
790
787
  current_step_nr=step_name.split("-")[0].to_i
791
788
 
792
- vm=VirtualBox::VM.find(boxname)
789
+ vm=VirtualBox::VM.find(boxname)
793
790
  snapnames=Array.new
794
791
 
795
792
  #If vm exists , look for snapshots
@@ -801,9 +798,9 @@ module Veewee
801
798
  while (snapshot!=nil)
802
799
  #puts "#{counter}:#{snapshot.name}"
803
800
  snapnames[counter]=snapshot.name
804
- counter=counter+1
801
+ counter=counter+1
805
802
  snapshot=snapshot.children[0]
806
- end
803
+ end
807
804
  end
808
805
 
809
806
  #find the last snapshot matching the state
@@ -815,7 +812,7 @@ module Veewee
815
812
  # puts "we found a bad state"
816
813
  last_good_state=c-1
817
814
  break
818
- end
815
+ end
819
816
  end
820
817
  #puts "Last good state: #{last_good_state}"
821
818
 
@@ -854,13 +851,13 @@ module Veewee
854
851
 
855
852
  #puts "last good state #{last_good_state}"
856
853
 
857
-
854
+
858
855
  if (current_step_nr > last_good_state)
859
856
 
860
857
  if (last_good_state==-1)
861
858
  #no initial snapshot is found, clean machine!
862
- vm=VirtualBox::VM.find(boxname)
863
-
859
+ vm=VirtualBox::VM.find(boxname)
860
+
864
861
  if !vm.nil?
865
862
  if vm.running?
866
863
  puts "Stopping machine"
@@ -869,7 +866,7 @@ module Veewee
869
866
  sleep 1
870
867
  end
871
868
  end
872
-
869
+
873
870
  #detaching cdroms (used to work in 3.x)
874
871
  # vm.medium_attachments.each do |m|
875
872
  # if m.type==:dvd
@@ -877,21 +874,21 @@ module Veewee
877
874
  # m.detach
878
875
  # end
879
876
  # end
880
-
877
+
881
878
  vm.reload
882
879
  puts "We found no good state so we are destroying the previous machine+disks"
883
880
  destroy_vm(boxname)
884
881
  end
885
-
882
+
886
883
  end
887
884
 
888
885
  #puts "(re-)executing step #{step_name}"
889
-
890
-
886
+
887
+
891
888
  yield
892
-
889
+
893
890
  #Need to look it up again because if it was an initial load
894
- vm=VirtualBox::VM.find(boxname)
891
+ vm=VirtualBox::VM.find(boxname)
895
892
  puts "Step [#{current_step_nr}] was successfully - saving state"
896
893
  vm.save_state
897
894
  sleep 2 #waiting for it to be ok
@@ -900,11 +897,11 @@ module Veewee
900
897
  vm.take_snapshot(step_name,"snapshot taken by veewee")
901
898
  sleep 2 #waiting for it to be started again
902
899
  vm.start
903
- end
900
+ end
904
901
 
905
902
  #pp snapnames
906
903
  end
907
-
904
+
908
905
 
909
906
  end #End Class
910
907
  end #End Module