veewee 0.0.2 → 0.1.0a
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.
- data/Gemfile +6 -1
- data/Gemfile.lock +7 -3
- data/{README.md → README} +53 -50
- data/Rakefile +31 -1
- data/TODO +1 -0
- data/bin/veewee +4 -7
- data/gems/.gitignore +2 -0
- data/lib/vagrant_init.rb +1 -1
- data/lib/veewee/command.rb +45 -48
- data/lib/veewee/scancode.rb +2 -9
- data/lib/veewee/session.rb +95 -173
- data/lib/veewee/shell.rb +1 -3
- data/lib/veewee/ssh.rb +6 -9
- data/lib/veewee/version.rb +1 -1
- data/lib/veewee/web.rb +2 -9
- data/templates/ubuntu-10.10-server-i386/postinstall.sh +1 -1
- data/tmp/.gitignore +2 -0
- data/veewee.gemspec +0 -3
- metadata +9 -63
- data/lib/veewee/config.rb +0 -5
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
veewee (0.
|
|
4
|
+
veewee (0.1.0a)
|
|
5
5
|
highline (~> 1.6.1)
|
|
6
6
|
net-ssh (~> 2.1.0)
|
|
7
7
|
popen4 (~> 0.1.2)
|
|
8
|
-
progressbar
|
|
9
8
|
thor (~> 0.14.6)
|
|
10
9
|
vagrant (~> 0.7.0)
|
|
11
10
|
|
|
@@ -30,7 +29,6 @@ GEM
|
|
|
30
29
|
popen4 (0.1.2)
|
|
31
30
|
Platform (>= 0.4.0)
|
|
32
31
|
open4 (>= 0.4.0)
|
|
33
|
-
progressbar (0.9.0)
|
|
34
32
|
rake (0.8.7)
|
|
35
33
|
thor (0.14.6)
|
|
36
34
|
vagrant (0.7.1)
|
|
@@ -50,4 +48,10 @@ PLATFORMS
|
|
|
50
48
|
ruby
|
|
51
49
|
|
|
52
50
|
DEPENDENCIES
|
|
51
|
+
highline
|
|
52
|
+
net-ssh
|
|
53
|
+
popen4
|
|
54
|
+
thor
|
|
55
|
+
vagrant
|
|
53
56
|
veewee!
|
|
57
|
+
virtualbox
|
data/{README.md → README}
RENAMED
|
@@ -1,44 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
# Veewee is currently broken due to changes in Virtualbox 4.x
|
|
2
|
+
# We will fix them soon and move veewee to a plugin for vagrant
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
VeeWee: the tool to easily build vagrant base boxes
|
|
6
|
+
===================================================
|
|
2
7
|
Vagrant is a great tool to test new things or changes in a virtual machine(Virtualbox) using either chef or puppet.
|
|
3
8
|
The first step is to download an existing 'base box'. I believe this scares a lot of people as they don't know who or how this box was build. Therefore lots of people end up first building their own base box to use with vagrant.
|
|
4
9
|
|
|
5
10
|
Veewee tries to automate this and to share the knowledge and sources you need to create a basebox. Instead of creating custom ISO's from your favorite distribution, it leverages the 'keyboardputscancode' command of Virtualbox so send the actual 'boot prompt' keysequence to boot an existing iso.
|
|
6
11
|
|
|
7
12
|
Before we can actually build the boxes, we need to take care of the minimal things to install:
|
|
13
|
+
- Currently this is still a very much 'it works on my machine only' code
|
|
8
14
|
- Have Virtualbox 4.x installed -> download it from http://download.virtualbox.org/virtualbox/
|
|
9
|
-
|
|
15
|
+
- Have ruby and rubygems working
|
|
16
|
+
- Have the rake gem installed -> gem install rake
|
|
10
17
|
|
|
11
18
|
ALPHA CODE: -> you're on your own....
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
### WILL UPDATE SOON ####
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
1)Installation: (from source)
|
|
24
|
+
===========================
|
|
15
25
|
$ git clone https://github.com/jedi4ever/veewee.git
|
|
16
26
|
$ cd veewee
|
|
17
27
|
$ gem install bundler
|
|
18
|
-
$ bundle install
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
$ bundle install
|
|
29
|
+
|
|
30
|
+
Installation: (as a gem)
|
|
31
|
+
========================
|
|
32
|
+
coming soon
|
|
33
|
+
|
|
34
|
+
List all templates
|
|
35
|
+
===================
|
|
36
|
+
$ rake templates
|
|
37
|
+
the following templates are available:
|
|
38
|
+
use rake define['<boxname>','CentOS-4.8-i386']
|
|
39
|
+
use rake define['<boxname>','CentOS-5.5-i386']
|
|
40
|
+
use rake define['<boxname>','ubuntu-10.04.1-server-i386']
|
|
41
|
+
use rake define['<boxname>','ubuntu-10.10-server-i386']
|
|
42
|
+
|
|
43
|
+
3) Define a new box (ex. Ubuntu 10.10 server i386) - this is essentially making a copy based on the templates provided above.
|
|
44
|
+
$ rake define['myubuntubox','ubuntu-10.10-server-i386']
|
|
32
45
|
template successfully copied
|
|
33
46
|
|
|
34
|
-
-> This copies over the templates/ubuntu-10.10-server-i386 to definition/myubuntubox
|
|
35
|
-
|
|
47
|
+
-> This copies over the files in templates/ubuntu-10.10-server-i386 to definition/myubuntubox
|
|
36
48
|
$ ls definitions/myubuntubox
|
|
37
49
|
definition.rb postinstall.sh postinstall2.sh preseed.cfg
|
|
38
50
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<pre>
|
|
51
|
+
4) Optionally modify the definition.rb , postinstall.sh or preseed.cfg
|
|
42
52
|
Veewee::Session.declare( {
|
|
43
53
|
:cpu_count => '1', :memory_size=> '256',
|
|
44
54
|
:disk_size => '10140', :disk_format => 'VDI',:disk_size => '10240' ,
|
|
@@ -65,40 +75,35 @@ Veewee::Session.declare( {
|
|
|
65
75
|
:postinstall_files => [ "postinstall.sh"],:postinstall_timeout => "10000"
|
|
66
76
|
}
|
|
67
77
|
)
|
|
68
|
-
</pre>
|
|
69
78
|
|
|
70
79
|
If you need to change values in the templates, be sure to run the rake undefine, the rake define again to copy the changes across.
|
|
71
80
|
|
|
72
|
-
|
|
73
|
-
$
|
|
74
|
-
|
|
75
|
-
-> the build assumes your iso files are in 'currentdir'/iso
|
|
76
|
-
-> if it can not find it will suggest to download the iso for you
|
|
81
|
+
5) Put your isofile inside the $VEEWEE/iso directory or if you don't run
|
|
82
|
+
$ rake build['myubuntubox]
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
$ vagrant basebox build 'myubuntubox'
|
|
84
|
+
-> This will show you the iso to download
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- Mount the ISO File :iso_file
|
|
84
|
-
- Boot up the machine and wait for :boot_time
|
|
85
|
-
- Send the keystrokes in :boot_cmd_sequence
|
|
86
|
-
- Startup a webserver on :kickstart_port to wait for a request for the :kickstart_file
|
|
87
|
-
- Wait for ssh login to work with :ssh_user , :ssh_password
|
|
88
|
-
- Sudo execute the :postinstall_files
|
|
86
|
+
6) Build the new box:
|
|
87
|
+
$ rake build['myubuntubox]
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
-> This will create a machine + disk according to the definition.rb
|
|
90
|
+
-> Note: :os_type_id = The internal Name Virtualbox uses for that Distribution
|
|
91
|
+
-> Mount the ISO File :iso_file
|
|
92
|
+
-> Boot up the machine and wait for :boot_time
|
|
93
|
+
-> Send the keystrokes in :boot_cmd_sequence
|
|
94
|
+
-> Startup a webserver on :kickstart_port to wait for a request for the :kickstart_file
|
|
95
|
+
-> Wait for ssh login to work with :ssh_user , :ssh_password
|
|
96
|
+
-> Sudo execute the :postinstall_files
|
|
92
97
|
|
|
93
|
-
|
|
98
|
+
7) Export the box into the boxes directory
|
|
99
|
+
$ rake export['myubuntubox']
|
|
94
100
|
|
|
95
|
-
|
|
101
|
+
vagrant package --base 'myubuntubox' --output 'boxes/myubuntubox.box'
|
|
102
|
+
vagrant box add 'myubuntubox' 'boxes/myubuntubox.box'
|
|
96
103
|
|
|
97
|
-
|
|
98
|
-
$ vagrant box add 'myubuntubox' 'myubuntubox.box'
|
|
104
|
+
-> This will show you the vagrant command to export and to add it your vagrant boxset
|
|
99
105
|
|
|
100
|
-
|
|
101
|
-
Start vagrant init in another window (as we have set the Virtualbox env to tmp before)
|
|
106
|
+
8) Start vagrant init in another window (as we have set the Virtualbox env to tmp before)
|
|
102
107
|
$ To import it into vagrant type:
|
|
103
108
|
|
|
104
109
|
To use it:
|
|
@@ -106,14 +111,12 @@ vagrant init 'myubuntubox'
|
|
|
106
111
|
vagrant up
|
|
107
112
|
vagrant ssh
|
|
108
113
|
|
|
109
|
-
|
|
114
|
+
9) If you have a setup working, share your 'definition' with me. That would be fun!
|
|
110
115
|
|
|
111
116
|
IDEAS:
|
|
112
|
-
|
|
113
117
|
- Now you integrate this with your CI build to create a daily basebox
|
|
114
118
|
|
|
115
119
|
FUTURE IDEAS:
|
|
116
|
-
|
|
117
120
|
- use snapshots to fastforward initial boot, and every postinstall command
|
|
118
121
|
- export to AMI too
|
|
119
122
|
- provide for more failsafe execution, testing parameters
|
data/Rakefile
CHANGED
|
@@ -3,8 +3,36 @@ require 'bundler'
|
|
|
3
3
|
require 'bundler/setup'
|
|
4
4
|
Bundler::GemHelper.install_tasks
|
|
5
5
|
|
|
6
|
+
#We set this in the ENV file
|
|
7
|
+
#ENV['GEM_PATH']=File.join(File.dirname(__FILE__),"gems")
|
|
8
|
+
#ENV['GEM_HOME']=File.join(File.dirname(__FILE__),"gems")
|
|
9
|
+
|
|
10
|
+
def check_environment
|
|
11
|
+
begin
|
|
12
|
+
require 'vagrant'
|
|
13
|
+
rescue LoadError
|
|
14
|
+
puts "you need to install dependencies:"
|
|
15
|
+
puts "gem install vagrant"
|
|
16
|
+
exit
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
begin
|
|
20
|
+
require 'net/ssh'
|
|
21
|
+
require 'virtualbox'
|
|
22
|
+
require 'webrick'
|
|
23
|
+
require 'popen4'
|
|
24
|
+
rescue LoadError
|
|
25
|
+
puts "hmm you had vagrant installed but are missing the net-ssh or virtualbox gem"
|
|
26
|
+
puts "gem install virtualbox net-ssh POpen4"
|
|
27
|
+
exit
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
#See if all gems and so are installed
|
|
32
|
+
check_environment
|
|
33
|
+
|
|
6
34
|
#Setup some base variables to use
|
|
7
|
-
veewee_dir=
|
|
35
|
+
veewee_dir= File.dirname(__FILE__)
|
|
8
36
|
definition_dir= File.expand_path(File.join(veewee_dir, "definitions"))
|
|
9
37
|
lib_dir= File.expand_path(File.join(veewee_dir, "lib"))
|
|
10
38
|
box_dir= File.expand_path(File.join(veewee_dir, "boxes"))
|
|
@@ -13,6 +41,8 @@ vbox_dir=File.expand_path(File.join(veewee_dir, "tmp"))
|
|
|
13
41
|
tmp_dir=File.expand_path(File.join(veewee_dir, "tmp"))
|
|
14
42
|
iso_dir=File.expand_path(File.join(veewee_dir, "iso"))
|
|
15
43
|
|
|
44
|
+
#needs to be moved to the config files to be allowed override
|
|
45
|
+
ENV['VBOX_USER_HOME']=vbox_dir
|
|
16
46
|
|
|
17
47
|
#Load Veewee::Session libraries
|
|
18
48
|
Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f|
|
data/TODO
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Maybe use Bittorrent to download iso - http://rubytorrent.rubyforge.org/
|
data/bin/veewee
CHANGED
|
@@ -30,8 +30,6 @@ Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f|
|
|
|
30
30
|
Veewee::Session.setenv({:veewee_dir => veewee_dir, :definition_dir => definition_dir,
|
|
31
31
|
:template_dir => template_dir, :iso_dir => iso_dir, :box_dir => box_dir, :tmp_dir => tmp_dir})
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
33
|
class VeeweeCLI < Thor
|
|
36
34
|
|
|
37
35
|
desc "init [NAME] [TEMPLATE]", "initializes a box from a template"
|
|
@@ -69,11 +67,10 @@ class VeeweeCLI < Thor
|
|
|
69
67
|
|
|
70
68
|
end
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
70
|
version=VirtualBox.version
|
|
75
|
-
if (version.match(/^4
|
|
76
|
-
|
|
71
|
+
if (version.match(/^4.x/))
|
|
72
|
+
VeeweeCLI.start
|
|
77
73
|
else
|
|
78
|
-
|
|
74
|
+
puts "veewee only supports VirtualBox 4.x"
|
|
79
75
|
end
|
|
76
|
+
|
data/gems/.gitignore
ADDED
data/lib/vagrant_init.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require 'veewee'
|
|
1
|
+
require 'veewee'
|
data/lib/veewee/command.rb
CHANGED
|
@@ -1,66 +1,63 @@
|
|
|
1
1
|
require 'veewee/session'
|
|
2
2
|
|
|
3
|
-
#Load Veewee::Session libraries
|
|
4
|
-
lib_dir= File.expand_path(File.join(File.dirname(__FILE__),"..","..", "lib"))
|
|
5
|
-
Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f| require f }
|
|
6
|
-
|
|
7
3
|
#Setup some base variables to use
|
|
8
|
-
|
|
4
|
+
veewee_dir= File.expand_path(File.join(File.dirname(__FILE__),"..",".."))
|
|
5
|
+
definition_dir= File.expand_path(File.join(".", "definitions"))
|
|
6
|
+
lib_dir= File.expand_path(File.join(veewee_dir, "lib"))
|
|
7
|
+
box_dir= File.expand_path(File.join(veewee_dir, "boxes"))
|
|
8
|
+
template_dir=File.expand_path(File.join(veewee_dir, "templates"))
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
definition_dir= File.expand_path(File.join(veewee_dir, "definitions"))
|
|
10
|
+
#vbox_dir=File.expand_path(File.join(veewee_dir, "tmp"))
|
|
12
11
|
tmp_dir=File.expand_path(File.join(veewee_dir, "tmp"))
|
|
12
|
+
|
|
13
13
|
iso_dir=File.expand_path(File.join(veewee_dir, "iso"))
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
#needs to be moved to the config files to be allowed override
|
|
16
|
+
#ENV['VBOX_USER_HOME']=vbox_dir
|
|
17
|
+
|
|
18
|
+
#Load Veewee::Session libraries
|
|
19
|
+
Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f|
|
|
20
|
+
require f }
|
|
15
21
|
|
|
16
22
|
#Initialize
|
|
17
23
|
Veewee::Session.setenv({:veewee_dir => veewee_dir, :definition_dir => definition_dir,
|
|
18
24
|
:template_dir => template_dir, :iso_dir => iso_dir, :box_dir => box_dir, :tmp_dir => tmp_dir})
|
|
19
25
|
|
|
20
|
-
module Veewee
|
|
21
|
-
class Command < Vagrant::Command::GroupBase
|
|
22
|
-
register "basebox","Commands to manage baseboxes"
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
module Vagrant
|
|
28
|
+
module Command
|
|
29
|
+
class BoxCommand < Vagrant::Command::GroupBase
|
|
30
|
+
# Do not register anymore, as this registration is already done in Vagrant core
|
|
31
|
+
# Since Ruby classes are 'open', we are just adding subcommands to the 'box' command
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
end
|
|
33
|
+
desc "templates", "List the currently available box templates"
|
|
34
|
+
def templates
|
|
35
|
+
Veewee::Session.list_templates
|
|
36
|
+
end
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
desc "init BOXNAME TEMPLATE", "Define a new box starting from a template"
|
|
39
|
+
def init(boxname, template)
|
|
40
|
+
puts "Init a new box #{boxname}, starting from template #{template}"
|
|
41
|
+
Veewee::Session.define(boxname,template)
|
|
42
|
+
end
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
desc "export [NAME]", "export the box"
|
|
57
|
-
method_options :force => :boolean
|
|
58
|
-
def export(boxname)
|
|
59
|
-
if (!boxname.nil?)
|
|
60
|
-
Veewee::Session.export_box(boxname)
|
|
44
|
+
desc "build BOXNAME", "Build the box BOXNAME"
|
|
45
|
+
def build(boxname)
|
|
46
|
+
puts "Building box #{boxname}"
|
|
47
|
+
Veewee::Session.build(boxname)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
desc "ostypes", "List the available Operating System types"
|
|
51
|
+
def ostypes
|
|
52
|
+
puts "Operating System types:"
|
|
53
|
+
Veewee::Session.list_ostypes
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
desc "clean", "Clean all unfinished builds"
|
|
57
|
+
def clean
|
|
58
|
+
puts "Cleaning all unfinished builds"
|
|
61
59
|
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
62
|
end
|
|
63
|
-
|
|
64
63
|
end
|
|
65
|
-
|
|
66
|
-
end
|
data/lib/veewee/scancode.rb
CHANGED
|
@@ -2,16 +2,11 @@ module Veewee
|
|
|
2
2
|
class Scancode
|
|
3
3
|
|
|
4
4
|
def self.send_sequence(vboxcmd,vname,sequence)
|
|
5
|
-
|
|
6
|
-
counter=0
|
|
5
|
+
|
|
7
6
|
sequence.each { |s|
|
|
8
|
-
counter=counter+1
|
|
9
|
-
|
|
10
7
|
s.gsub!(/%IP%/,Veewee::Session.local_ip);
|
|
11
8
|
s.gsub!(/%PORT%/,'7122');
|
|
12
9
|
s.gsub!(/%NAME%/, vname);
|
|
13
|
-
puts "Typing:[#{counter}]: "+s
|
|
14
|
-
|
|
15
10
|
keycodes=string_to_keycode(s)
|
|
16
11
|
|
|
17
12
|
# VBox seems to have issues with sending the scancodes as one big
|
|
@@ -26,15 +21,13 @@ module Veewee
|
|
|
26
21
|
sleep 1
|
|
27
22
|
}
|
|
28
23
|
|
|
29
|
-
puts "Done typing."
|
|
30
|
-
puts
|
|
31
24
|
|
|
32
25
|
end
|
|
33
26
|
|
|
34
27
|
def self.send_keycode(vboxcmd,vname,keycode)
|
|
35
28
|
command= "#{vboxcmd} controlvm '#{vname}' keyboardputscancode #{keycode}"
|
|
36
29
|
#puts "#{command}"
|
|
37
|
-
IO.popen("#{command}") { |f| print '' }
|
|
30
|
+
IO.popen("#{command}") { |f| print '.' }
|
|
38
31
|
end
|
|
39
32
|
|
|
40
33
|
def self.string_to_keycode(thestring)
|
data/lib/veewee/session.rb
CHANGED
|
@@ -2,10 +2,6 @@ require 'digest/md5'
|
|
|
2
2
|
require 'socket'
|
|
3
3
|
require 'net/scp'
|
|
4
4
|
require 'pp'
|
|
5
|
-
require 'open-uri'
|
|
6
|
-
require 'progressbar'
|
|
7
|
-
require 'highline/import'
|
|
8
|
-
require 'tempfile'
|
|
9
5
|
|
|
10
6
|
|
|
11
7
|
module Veewee
|
|
@@ -45,43 +41,25 @@ module Veewee
|
|
|
45
41
|
|
|
46
42
|
end
|
|
47
43
|
|
|
48
|
-
def self.define(boxname,template_name
|
|
44
|
+
def self.define(boxname,template_name)
|
|
49
45
|
#Check if template_name exists
|
|
50
|
-
|
|
51
|
-
options = { "force" => false, "format" => "vagrant" }.merge(options)
|
|
52
|
-
|
|
46
|
+
#puts @veewee_dir
|
|
53
47
|
if File.directory?(File.join(@template_dir,template_name))
|
|
54
48
|
else
|
|
55
|
-
puts "
|
|
56
|
-
exit
|
|
49
|
+
puts "this template can not be found, use vagrant box templates to list all templates"
|
|
57
50
|
end
|
|
58
51
|
if !File.exists?(@definition_dir)
|
|
59
52
|
FileUtils.mkdir(@definition_dir)
|
|
60
53
|
end
|
|
61
|
-
|
|
62
54
|
if File.directory?(File.join(@definition_dir,boxname))
|
|
63
|
-
|
|
64
|
-
puts "The definition for #{boxname} already exists. Use --force to overwrite"
|
|
65
|
-
exit
|
|
66
|
-
end
|
|
55
|
+
puts "this definition already exists"
|
|
67
56
|
else
|
|
68
57
|
FileUtils.mkdir(File.join(@definition_dir,boxname))
|
|
58
|
+
FileUtils.cp_r(File.join(@template_dir,template_name,'.'),File.join(@definition_dir,boxname))
|
|
59
|
+
puts "template succesfully copied"
|
|
69
60
|
end
|
|
70
|
-
FileUtils.cp_r(File.join(@template_dir,template_name,'.'),File.join(@definition_dir,boxname))
|
|
71
|
-
puts "The basebox '#{boxname}' has been succesfully created from the template ''#{template_name}'"
|
|
72
|
-
puts "You can now edit the definition files stored in definitions/#{boxname}"
|
|
73
|
-
puts "or build the box with:"
|
|
74
|
-
if (options["format"]=='vagrant')
|
|
75
|
-
puts "vagrant basebox build '#{boxname}'"
|
|
76
|
-
end
|
|
77
|
-
if (options["format"]=='veewee')
|
|
78
|
-
puts "veewee build '#{boxname}'"
|
|
79
|
-
end
|
|
80
|
-
|
|
81
61
|
end
|
|
82
62
|
|
|
83
|
-
|
|
84
|
-
|
|
85
63
|
|
|
86
64
|
def self.definition_exists?(boxname)
|
|
87
65
|
if File.directory?(File.join(@definition_dir,boxname))
|
|
@@ -107,20 +85,15 @@ module Veewee
|
|
|
107
85
|
end
|
|
108
86
|
end
|
|
109
87
|
|
|
110
|
-
def self.list_templates
|
|
111
|
-
puts "
|
|
88
|
+
def self.list_templates
|
|
89
|
+
puts "the following templates are available:"
|
|
112
90
|
subdirs=Dir.glob("#{@template_dir}/*")
|
|
113
91
|
subdirs.each do |sub|
|
|
114
92
|
if File.directory?("#{sub}")
|
|
115
93
|
definition=Dir.glob("#{sub}/definition.rb")
|
|
116
94
|
if definition.length!=0
|
|
117
95
|
name=sub.sub(/#{@template_dir}\//,'')
|
|
118
|
-
|
|
119
|
-
puts "vagrant basebox define '<boxname>' '#{name}'"
|
|
120
|
-
end
|
|
121
|
-
if (options[:format]=='veewee')
|
|
122
|
-
puts "veewee define '<boxname>' '#{name}'"
|
|
123
|
-
end
|
|
96
|
+
puts "vagrant box init '<boxname>' '#{name}'"
|
|
124
97
|
end
|
|
125
98
|
end
|
|
126
99
|
end
|
|
@@ -138,10 +111,9 @@ module Veewee
|
|
|
138
111
|
puts "Not yet implemented"
|
|
139
112
|
end
|
|
140
113
|
|
|
141
|
-
def self.verify_iso(filename
|
|
114
|
+
def self.verify_iso(filename)
|
|
142
115
|
if File.exists?(File.join(@iso_dir,filename))
|
|
143
|
-
puts
|
|
144
|
-
puts "Verifying the isofile #{filename} is ok."
|
|
116
|
+
puts "isofile #{filename} is available"
|
|
145
117
|
else
|
|
146
118
|
full_path=File.join(@iso_dir,filename)
|
|
147
119
|
path1=Pathname.new(full_path)
|
|
@@ -149,23 +121,15 @@ module Veewee
|
|
|
149
121
|
rel_path=path1.relative_path_from(path2).to_s
|
|
150
122
|
|
|
151
123
|
puts
|
|
152
|
-
puts "
|
|
153
|
-
puts "-
|
|
154
|
-
puts "-
|
|
124
|
+
puts "Isofile is not found. The definition suggested the following URL to download:"
|
|
125
|
+
puts "-url: #{@definition[:iso_src]}"
|
|
126
|
+
puts "-md5: #{@definition[:iso_md5]}"
|
|
155
127
|
puts ""
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
puts "You have choosen for manual download: "
|
|
162
|
-
puts "curl -C - -L '#{@definition[:iso_src]}' -o '#{rel_path}'"
|
|
163
|
-
puts "md5 '#{rel_path}' "
|
|
164
|
-
puts
|
|
165
|
-
exit
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
|
|
128
|
+
puts "type:"
|
|
129
|
+
puts "curl -C - -L '#{@definition[:iso_src]}' -o '#{rel_path}'"
|
|
130
|
+
puts "md5 '#{rel_path}' "
|
|
131
|
+
puts
|
|
132
|
+
exit
|
|
169
133
|
end
|
|
170
134
|
|
|
171
135
|
end
|
|
@@ -181,10 +145,7 @@ module Veewee
|
|
|
181
145
|
puts "Not yet implemented"
|
|
182
146
|
end
|
|
183
147
|
|
|
184
|
-
def self.build(boxname
|
|
185
|
-
|
|
186
|
-
options = { "force" => false, "format" => "vagrant" }.merge(options)
|
|
187
|
-
|
|
148
|
+
def self.build(boxname)
|
|
188
149
|
#Now we have to load the definition (reads definition.rb)
|
|
189
150
|
load_definition(boxname)
|
|
190
151
|
|
|
@@ -199,13 +160,9 @@ module Veewee
|
|
|
199
160
|
|
|
200
161
|
verify_iso(@definition[:iso_file])
|
|
201
162
|
|
|
202
|
-
if (options["force"]==false)
|
|
203
|
-
else
|
|
204
|
-
puts "Forcing build by destroying #{boxname} machine"
|
|
205
|
-
destroy_vm(boxname)
|
|
206
|
-
end
|
|
207
|
-
|
|
208
163
|
checksums=calculate_checksums(@definition,boxname)
|
|
164
|
+
|
|
165
|
+
|
|
209
166
|
|
|
210
167
|
transaction(boxname,"0-initial-#{checksums[0]}",checksums) do
|
|
211
168
|
|
|
@@ -230,12 +187,11 @@ module Veewee
|
|
|
230
187
|
|
|
231
188
|
|
|
232
189
|
#waiting for it to boot
|
|
233
|
-
puts "Waiting for the machine to boot"
|
|
234
190
|
sleep @definition[:boot_wait].to_i
|
|
235
191
|
|
|
192
|
+
puts "sending keys"
|
|
236
193
|
Veewee::Scancode.send_sequence("#{@vboxcmd}","#{boxname}",@definition[:boot_cmd_sequence])
|
|
237
194
|
|
|
238
|
-
puts "Starting a webserver on port #{@definition[:kickstart_port]}"
|
|
239
195
|
#:kickstart_port => "7122", :kickstart_ip => self.local_ip, :kickstart_timeout => 1000,:kickstart_file => "preseed.cfg",
|
|
240
196
|
Veewee::Web.wait_for_request(@definition[:kickstart_file],{:port => @definition[:kickstart_port],
|
|
241
197
|
:host => @definition[:kickstart_ip], :timeout => @definition[:kickstart_timeout],
|
|
@@ -243,16 +199,15 @@ module Veewee
|
|
|
243
199
|
|
|
244
200
|
Veewee::Ssh.when_ssh_login_works("localhost",ssh_options) do
|
|
245
201
|
#Transfer version of Virtualbox to $HOME/.vbox_version
|
|
246
|
-
versionfile=
|
|
247
|
-
versionfile.
|
|
248
|
-
versionfile
|
|
249
|
-
Veewee::Ssh.transfer_file("localhost",versionfile.path,".vbox_version", ssh_options)
|
|
250
|
-
versionfile.close
|
|
251
|
-
versionfile.delete
|
|
202
|
+
versionfile=File.join(@tmp_dir,".vbox_version")
|
|
203
|
+
File.open(versionfile, 'w') {|f| f.write("#{VirtualBox::Global.global.lib.virtualbox.version}") }
|
|
204
|
+
Veewee::Ssh.transfer_file("localhost",versionfile,ssh_options)
|
|
252
205
|
end
|
|
253
206
|
end #initial Transaction
|
|
254
207
|
|
|
255
|
-
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
256
211
|
counter=1
|
|
257
212
|
@definition[:postinstall_files].each do |postinstall_file|
|
|
258
213
|
|
|
@@ -315,58 +270,7 @@ module Veewee
|
|
|
315
270
|
vm.save
|
|
316
271
|
end
|
|
317
272
|
|
|
318
|
-
def self.
|
|
319
|
-
|
|
320
|
-
load_definition(boxname)
|
|
321
|
-
|
|
322
|
-
#:destroy_medium => :delete, will delete machine + all media attachments
|
|
323
|
-
#vm.destroy(:destroy_medium => :delete)
|
|
324
|
-
##vm.destroy(:destroy_image => true)
|
|
325
|
-
|
|
326
|
-
#VBoxManage unregistervm "test-machine" --delete
|
|
327
|
-
#because the destroy does remove the .vbox file on 4.0.x
|
|
328
|
-
#PDB
|
|
329
|
-
#vm.destroy()
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
vm=VirtualBox::VM.find(boxname)
|
|
334
|
-
|
|
335
|
-
if (!vm.nil? && !(vm.powered_off?))
|
|
336
|
-
puts "Shutting down vm #{boxname}"
|
|
337
|
-
#We force it here, maybe vm.shutdown is cleaner
|
|
338
|
-
vm.stop
|
|
339
|
-
end
|
|
340
|
-
sleep 3
|
|
341
|
-
|
|
342
|
-
command="#{@vboxcmd} unregistervm '#{boxname}' --delete"
|
|
343
|
-
|
|
344
|
-
puts "Deleting vm #{boxname}"
|
|
345
|
-
|
|
346
|
-
#Exec and system stop the execution here
|
|
347
|
-
Veewee::Shell.execute("#{command}")
|
|
348
|
-
sleep 1
|
|
349
|
-
|
|
350
|
-
#if the disk was not attached when the machine was destroyed we also need to delete the disk
|
|
351
|
-
location=boxname+"."+@definition[:disk_format].downcase
|
|
352
|
-
found=false
|
|
353
|
-
VirtualBox::HardDrive.all.each do |d|
|
|
354
|
-
if !d.location.match(/#{location}/).nil?
|
|
355
|
-
|
|
356
|
-
command="#{@vboxcmd} closemedium disk '#{d.location}' --delete"
|
|
357
|
-
puts "Deleting disk #{d.location}"
|
|
358
|
-
Veewee::Shell.execute("#{command}")
|
|
359
|
-
#v.3
|
|
360
|
-
#d.destroy(true)
|
|
361
|
-
break
|
|
362
|
-
end
|
|
363
|
-
end
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
end
|
|
368
|
-
|
|
369
|
-
def self.create_vm(boxname,force=false)
|
|
273
|
+
def self.create_vm(boxname)
|
|
370
274
|
|
|
371
275
|
#Verifying the os.id with the :os_type_id specified
|
|
372
276
|
matchfound=false
|
|
@@ -389,8 +293,8 @@ module Veewee
|
|
|
389
293
|
vm.stop
|
|
390
294
|
end
|
|
391
295
|
|
|
392
|
-
if !vm.nil?
|
|
393
|
-
puts "
|
|
296
|
+
if !vm.nil?
|
|
297
|
+
puts "box already exists"
|
|
394
298
|
#vm.stop
|
|
395
299
|
#vm.destroy
|
|
396
300
|
else
|
|
@@ -398,9 +302,11 @@ module Veewee
|
|
|
398
302
|
#Box does not exist, we can start to create it
|
|
399
303
|
|
|
400
304
|
command="#{@vboxcmd} createvm --name '#{boxname}' --ostype '#{@definition[:os_type_id]}' --register"
|
|
305
|
+
puts command
|
|
401
306
|
|
|
402
307
|
#Exec and system stop the execution here
|
|
403
308
|
Veewee::Shell.execute("#{command}")
|
|
309
|
+
sleep 3
|
|
404
310
|
|
|
405
311
|
end
|
|
406
312
|
|
|
@@ -416,8 +322,7 @@ module Veewee
|
|
|
416
322
|
vm.os_type_id=@definition[:os_type_id]
|
|
417
323
|
vm.cpu_count=@definition[:cpu_count].to_i
|
|
418
324
|
vm.name=boxname
|
|
419
|
-
|
|
420
|
-
puts "Creating vm #{vm.name} : #{vm.memory_size}M - #{vm.cpu_count} CPU - #{vm.os_type_id}"
|
|
325
|
+
|
|
421
326
|
#setting bootorder
|
|
422
327
|
vm.boot_order[0]=:hard_disk
|
|
423
328
|
vm.boot_order[1]=:dvd
|
|
@@ -443,7 +348,7 @@ module Veewee
|
|
|
443
348
|
end
|
|
444
349
|
|
|
445
350
|
if !found
|
|
446
|
-
puts "
|
|
351
|
+
puts "creating new harddrive"
|
|
447
352
|
|
|
448
353
|
#newdisk=VirtualBox::HardDrive.new
|
|
449
354
|
#newdisk.format=@definition[:disk_format]
|
|
@@ -459,7 +364,8 @@ module Veewee
|
|
|
459
364
|
place=results.gets.chop
|
|
460
365
|
results.close
|
|
461
366
|
|
|
462
|
-
|
|
367
|
+
puts "#{command}"
|
|
368
|
+
command ="#{@vboxcmd} createhd --filename '#{place}/#{boxname}/#{boxname}.#{@definition[:disk_format]}' --size '#{@definition[:disk_size].to_i}' --format #{@definition[:disk_format]}"
|
|
463
369
|
Veewee::Shell.execute("#{command}")
|
|
464
370
|
|
|
465
371
|
end
|
|
@@ -488,17 +394,20 @@ module Veewee
|
|
|
488
394
|
results.close
|
|
489
395
|
|
|
490
396
|
location="#{place}/#{boxname}/"+location
|
|
491
|
-
|
|
397
|
+
|
|
398
|
+
puts "location=#{location}"
|
|
399
|
+
|
|
492
400
|
|
|
493
401
|
#command => "${vboxcmd} storageattach '${vname}' --storagectl 'SATA Controller' --port 0 --device 0 --type hdd --medium '${vname}.vdi'",
|
|
494
402
|
command ="#{@vboxcmd} storageattach '#{boxname}' --storagectl 'SATA Controller' --port 0 --device 0 --type hdd --medium '#{location}'"
|
|
403
|
+
puts "#{command}"
|
|
495
404
|
Veewee::Shell.execute("#{command}")
|
|
496
405
|
|
|
497
406
|
end
|
|
498
407
|
|
|
499
408
|
def self.mount_isofile(boxname,isofile)
|
|
500
409
|
full_iso_file=File.join(@iso_dir,isofile)
|
|
501
|
-
puts "
|
|
410
|
+
puts "#{full_iso_file}"
|
|
502
411
|
#command => "${vboxcmd} storageattach '${vname}' --storagectl 'IDE Controller' --type dvddrive --port 1 --device 0 --medium '${isodst}' ";
|
|
503
412
|
command ="#{@vboxcmd} storageattach '#{boxname}' --storagectl 'IDE Controller' --type dvddrive --port 1 --device 0 --medium '#{full_iso_file}'"
|
|
504
413
|
Veewee::Shell.execute("#{command}")
|
|
@@ -534,7 +443,10 @@ module Veewee
|
|
|
534
443
|
puts "Available os types:"
|
|
535
444
|
VirtualBox::Global.global.lib.virtualbox.guest_os_types.collect { |os|
|
|
536
445
|
puts "#{os.id}: #{os.description}"
|
|
537
|
-
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
puts
|
|
449
|
+
|
|
538
450
|
end
|
|
539
451
|
|
|
540
452
|
|
|
@@ -565,28 +477,11 @@ module Veewee
|
|
|
565
477
|
end
|
|
566
478
|
end
|
|
567
479
|
|
|
480
|
+
pp checksums
|
|
568
481
|
return checksums
|
|
569
482
|
|
|
570
483
|
end
|
|
571
484
|
|
|
572
|
-
def self.download_progress(url,localfile)
|
|
573
|
-
pbar = nil
|
|
574
|
-
URI.parse(url).open(
|
|
575
|
-
:content_length_proc => lambda {|t|
|
|
576
|
-
if t && 0 < t
|
|
577
|
-
pbar = ProgressBar.new("Fetching file", t)
|
|
578
|
-
pbar.file_transfer_mode
|
|
579
|
-
end
|
|
580
|
-
},
|
|
581
|
-
:progress_proc => lambda {|s|
|
|
582
|
-
pbar.set s if pbar
|
|
583
|
-
}) { |src|
|
|
584
|
-
open("#{localfile}","wb") { |dst|
|
|
585
|
-
dst.write(src.read)
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
end
|
|
590
485
|
|
|
591
486
|
def self.transaction(boxname,step_name,checksums,&block)
|
|
592
487
|
|
|
@@ -609,6 +504,8 @@ module Veewee
|
|
|
609
504
|
end
|
|
610
505
|
end
|
|
611
506
|
|
|
507
|
+
pp snapnames
|
|
508
|
+
|
|
612
509
|
#find the last snapshot matching the state
|
|
613
510
|
counter=[snapnames.length, checksums.length].min-1
|
|
614
511
|
last_good_state=counter
|
|
@@ -620,14 +517,14 @@ module Veewee
|
|
|
620
517
|
break
|
|
621
518
|
end
|
|
622
519
|
end
|
|
623
|
-
|
|
520
|
+
puts "Last good state: #{last_good_state}"
|
|
624
521
|
|
|
625
522
|
if (current_step_nr < last_good_state)
|
|
626
|
-
|
|
523
|
+
puts "fast forwarding #{step_name}"
|
|
627
524
|
return
|
|
628
525
|
end
|
|
629
526
|
|
|
630
|
-
|
|
527
|
+
puts "Current step: #{current_step_nr}"
|
|
631
528
|
if (current_step_nr == last_good_state)
|
|
632
529
|
if vm.running?
|
|
633
530
|
vm.stop
|
|
@@ -637,14 +534,14 @@ module Veewee
|
|
|
637
534
|
#puts "remove old snapshots"
|
|
638
535
|
|
|
639
536
|
for s in (last_good_state+1)..(snapnames.length-1)
|
|
640
|
-
puts "
|
|
537
|
+
puts "removing snapname #{snapnames[s]}"
|
|
641
538
|
snapshot=vm.find_snapshot(snapnames[s])
|
|
642
539
|
snapshot.destroy
|
|
643
540
|
#puts snapshot
|
|
644
541
|
end
|
|
645
542
|
|
|
646
543
|
vm.reload
|
|
647
|
-
puts "
|
|
544
|
+
puts "action load #{step_name}"
|
|
648
545
|
sleep 2
|
|
649
546
|
goodsnap=vm.find_snapshot(snapnames[last_good_state])
|
|
650
547
|
goodsnap.restore
|
|
@@ -654,7 +551,7 @@ module Veewee
|
|
|
654
551
|
|
|
655
552
|
end
|
|
656
553
|
|
|
657
|
-
|
|
554
|
+
puts "last good state #{last_good_state}"
|
|
658
555
|
|
|
659
556
|
|
|
660
557
|
if (current_step_nr > last_good_state)
|
|
@@ -665,41 +562,66 @@ module Veewee
|
|
|
665
562
|
|
|
666
563
|
if !vm.nil?
|
|
667
564
|
if vm.running?
|
|
668
|
-
puts "
|
|
565
|
+
puts "stopping machine"
|
|
669
566
|
vm.stop
|
|
670
567
|
while vm.running?
|
|
671
568
|
sleep 1
|
|
672
569
|
end
|
|
673
570
|
end
|
|
674
571
|
|
|
675
|
-
#detaching cdroms
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
572
|
+
#detaching cdroms
|
|
573
|
+
vm.medium_attachments.each do |m|
|
|
574
|
+
if m.type==:dvd
|
|
575
|
+
puts "detaching dvd"
|
|
576
|
+
m.detach
|
|
577
|
+
end
|
|
578
|
+
end
|
|
682
579
|
|
|
683
580
|
vm.reload
|
|
684
|
-
puts "
|
|
685
|
-
|
|
581
|
+
puts "destroying machine+disks"
|
|
582
|
+
#:destroy_medium => :delete, will delete machine + all media attachments
|
|
583
|
+
#vm.destroy(:destroy_medium => :delete)
|
|
584
|
+
##vm.destroy(:destroy_image => true)
|
|
585
|
+
|
|
586
|
+
#VBoxManage unregistervm "test-machine" --delete
|
|
587
|
+
#because the destroy does remove the .vbox file on 4.0.x
|
|
588
|
+
#PDB
|
|
589
|
+
#vm.destroy()
|
|
590
|
+
|
|
591
|
+
command="#{@vboxcmd} unregistervm '#{boxname}' --delete"
|
|
592
|
+
puts command
|
|
593
|
+
|
|
594
|
+
#Exec and system stop the execution here
|
|
595
|
+
Veewee::Shell.execute("#{command}")
|
|
596
|
+
|
|
597
|
+
#if the disk was not attached when the machine was destroyed we also need to delete the disk
|
|
598
|
+
location=boxname+"."+@definition[:disk_format].downcase
|
|
599
|
+
found=false
|
|
600
|
+
VirtualBox::HardDrive.all.each do |d|
|
|
601
|
+
if !d.location.match(/#{location}/).nil?
|
|
602
|
+
d.destroy(true)
|
|
603
|
+
break
|
|
604
|
+
end
|
|
605
|
+
end
|
|
686
606
|
end
|
|
687
607
|
|
|
688
608
|
end
|
|
689
609
|
|
|
690
|
-
|
|
610
|
+
puts "(re-)executing step #{step_name}"
|
|
691
611
|
|
|
692
612
|
|
|
693
613
|
yield
|
|
694
|
-
|
|
614
|
+
puts "seeking #{boxname}"
|
|
695
615
|
#Need to look it up again because if it was an initial load
|
|
696
616
|
vm=VirtualBox::VM.find(boxname)
|
|
697
|
-
puts "
|
|
617
|
+
puts "saving state"
|
|
698
618
|
vm.save_state
|
|
619
|
+
puts "waiting for 2 secs"
|
|
699
620
|
sleep 2 #waiting for it to be ok
|
|
700
|
-
|
|
621
|
+
puts "about to snapshot #{vm}"
|
|
701
622
|
#take snapshot after succesful execution
|
|
702
623
|
vm.take_snapshot(step_name,"snapshot taken by veewee")
|
|
624
|
+
puts "wait 2 secs before starting"
|
|
703
625
|
sleep 2 #waiting for it to be started again
|
|
704
626
|
vm.start
|
|
705
627
|
end
|
data/lib/veewee/shell.rb
CHANGED
data/lib/veewee/ssh.rb
CHANGED
|
@@ -5,10 +5,9 @@ module Veewee
|
|
|
5
5
|
|
|
6
6
|
defaults={ :port => '22', :timeout => 200 , :user => 'vagrant', :password => 'vagrant'}
|
|
7
7
|
|
|
8
|
-
options
|
|
8
|
+
puts "checking if login works ssh => #{options[:port]}"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
puts "Trying ssh login with user #{options[:user]} to sshd on port => #{options[:port]}"
|
|
10
|
+
options=defaults.merge(options)
|
|
12
11
|
|
|
13
12
|
begin
|
|
14
13
|
Timeout::timeout(options[:timeout]) do
|
|
@@ -34,13 +33,11 @@ module Veewee
|
|
|
34
33
|
end
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
def self.transfer_file(host,filename,
|
|
36
|
+
def self.transfer_file(host,filename,options)
|
|
38
37
|
Net::SSH.start( host,options[:user],options ) do |ssh|
|
|
39
|
-
puts "Transferring #{filename}
|
|
40
|
-
ssh.scp.upload!( filename,
|
|
41
|
-
|
|
42
|
-
print "."
|
|
43
|
-
|
|
38
|
+
puts "Transferring #{filename} "
|
|
39
|
+
ssh.scp.upload!( filename, '.' ) do |ch, name, sent, total|
|
|
40
|
+
print "\r#{filename}: #{(sent.to_f * 100 / total.to_f).to_i}%"
|
|
44
41
|
end
|
|
45
42
|
end
|
|
46
43
|
puts
|
data/lib/veewee/version.rb
CHANGED
data/lib/veewee/web.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Veewee
|
|
|
14
14
|
def do_GET(request,response)
|
|
15
15
|
response['Content-Type']='text/plain'
|
|
16
16
|
response.status = 200
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
displayfile=File.open(@localfile,'r')
|
|
19
19
|
content=displayfile.read()
|
|
20
20
|
response.body=content
|
|
@@ -26,19 +26,12 @@ module Veewee
|
|
|
26
26
|
|
|
27
27
|
def self.wait_for_request(filename,options={:timeout => 10, :web_dir => "", :port => 7125})
|
|
28
28
|
|
|
29
|
-
webrick_logger=WEBrick::Log.new("/dev/null", WEBrick::Log::INFO)
|
|
30
|
-
|
|
31
29
|
web_dir=options[:web_dir]
|
|
32
30
|
filename=filename
|
|
33
|
-
s= HTTPServer.new(
|
|
34
|
-
:Port => options[:port],
|
|
35
|
-
:Logger => webrick_logger,
|
|
36
|
-
:AccessLog => webrick_logger
|
|
37
|
-
)
|
|
31
|
+
s= HTTPServer.new(:Port => options[:port])
|
|
38
32
|
s.mount("/#{filename}", FileServlet,File.join(web_dir,filename))
|
|
39
33
|
trap("INT"){
|
|
40
34
|
s.shutdown
|
|
41
|
-
puts "Stopping webserver"
|
|
42
35
|
exit
|
|
43
36
|
}
|
|
44
37
|
s.start
|
|
@@ -36,7 +36,7 @@ VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
|
|
|
36
36
|
cd /tmp
|
|
37
37
|
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
|
|
38
38
|
mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
|
|
39
|
-
sh /mnt/VBoxLinuxAdditions.run
|
|
39
|
+
sh /mnt/VBoxLinuxAdditions-x86.run
|
|
40
40
|
umount /mnt
|
|
41
41
|
|
|
42
42
|
rm VBoxGuestAdditions_$VBOX_VERSION.iso
|
data/tmp/.gitignore
ADDED
data/veewee.gemspec
CHANGED
|
@@ -19,9 +19,6 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.add_dependency "popen4", "~> 0.1.2"
|
|
20
20
|
s.add_dependency "thor", "~> 0.14.6"
|
|
21
21
|
s.add_dependency "highline", "~> 1.6.1"
|
|
22
|
-
s.add_dependency "progressbar"
|
|
23
|
-
|
|
24
|
-
s.add_development_dependency "bundler", ">= 1.0.0"
|
|
25
22
|
|
|
26
23
|
s.files = `git ls-files`.split("\n")
|
|
27
24
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
metadata
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: veewee
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
prerelease:
|
|
5
|
-
|
|
6
|
-
- 0
|
|
7
|
-
- 0
|
|
8
|
-
- 2
|
|
9
|
-
version: 0.0.2
|
|
4
|
+
prerelease: 5
|
|
5
|
+
version: 0.1.0a
|
|
10
6
|
platform: ruby
|
|
11
7
|
authors:
|
|
12
8
|
- Patrick Debois
|
|
@@ -15,7 +11,7 @@ autorequire:
|
|
|
15
11
|
bindir: bin
|
|
16
12
|
cert_chain: []
|
|
17
13
|
|
|
18
|
-
date: 2011-02-
|
|
14
|
+
date: 2011-02-06 00:00:00 +01:00
|
|
19
15
|
default_executable:
|
|
20
16
|
dependencies:
|
|
21
17
|
- !ruby/object:Gem::Dependency
|
|
@@ -25,10 +21,6 @@ dependencies:
|
|
|
25
21
|
requirements:
|
|
26
22
|
- - ~>
|
|
27
23
|
- !ruby/object:Gem::Version
|
|
28
|
-
segments:
|
|
29
|
-
- 0
|
|
30
|
-
- 7
|
|
31
|
-
- 0
|
|
32
24
|
version: 0.7.0
|
|
33
25
|
type: :runtime
|
|
34
26
|
prerelease: false
|
|
@@ -40,10 +32,6 @@ dependencies:
|
|
|
40
32
|
requirements:
|
|
41
33
|
- - ~>
|
|
42
34
|
- !ruby/object:Gem::Version
|
|
43
|
-
segments:
|
|
44
|
-
- 2
|
|
45
|
-
- 1
|
|
46
|
-
- 0
|
|
47
35
|
version: 2.1.0
|
|
48
36
|
type: :runtime
|
|
49
37
|
prerelease: false
|
|
@@ -55,10 +43,6 @@ dependencies:
|
|
|
55
43
|
requirements:
|
|
56
44
|
- - ~>
|
|
57
45
|
- !ruby/object:Gem::Version
|
|
58
|
-
segments:
|
|
59
|
-
- 0
|
|
60
|
-
- 1
|
|
61
|
-
- 2
|
|
62
46
|
version: 0.1.2
|
|
63
47
|
type: :runtime
|
|
64
48
|
prerelease: false
|
|
@@ -70,10 +54,6 @@ dependencies:
|
|
|
70
54
|
requirements:
|
|
71
55
|
- - ~>
|
|
72
56
|
- !ruby/object:Gem::Version
|
|
73
|
-
segments:
|
|
74
|
-
- 0
|
|
75
|
-
- 14
|
|
76
|
-
- 6
|
|
77
57
|
version: 0.14.6
|
|
78
58
|
type: :runtime
|
|
79
59
|
prerelease: false
|
|
@@ -85,42 +65,10 @@ dependencies:
|
|
|
85
65
|
requirements:
|
|
86
66
|
- - ~>
|
|
87
67
|
- !ruby/object:Gem::Version
|
|
88
|
-
segments:
|
|
89
|
-
- 1
|
|
90
|
-
- 6
|
|
91
|
-
- 1
|
|
92
68
|
version: 1.6.1
|
|
93
69
|
type: :runtime
|
|
94
70
|
prerelease: false
|
|
95
71
|
version_requirements: *id005
|
|
96
|
-
- !ruby/object:Gem::Dependency
|
|
97
|
-
name: progressbar
|
|
98
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
|
99
|
-
none: false
|
|
100
|
-
requirements:
|
|
101
|
-
- - ">="
|
|
102
|
-
- !ruby/object:Gem::Version
|
|
103
|
-
segments:
|
|
104
|
-
- 0
|
|
105
|
-
version: "0"
|
|
106
|
-
type: :runtime
|
|
107
|
-
prerelease: false
|
|
108
|
-
version_requirements: *id006
|
|
109
|
-
- !ruby/object:Gem::Dependency
|
|
110
|
-
name: bundler
|
|
111
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
|
112
|
-
none: false
|
|
113
|
-
requirements:
|
|
114
|
-
- - ">="
|
|
115
|
-
- !ruby/object:Gem::Version
|
|
116
|
-
segments:
|
|
117
|
-
- 1
|
|
118
|
-
- 0
|
|
119
|
-
- 0
|
|
120
|
-
version: 1.0.0
|
|
121
|
-
type: :development
|
|
122
|
-
prerelease: false
|
|
123
|
-
version_requirements: *id007
|
|
124
72
|
description: Expand the 'vagrant box' command to support the creation of base boxes from scratch
|
|
125
73
|
email:
|
|
126
74
|
- patrick.debois@jedi.be
|
|
@@ -136,14 +84,15 @@ files:
|
|
|
136
84
|
- .rvmrc
|
|
137
85
|
- Gemfile
|
|
138
86
|
- Gemfile.lock
|
|
139
|
-
- README
|
|
87
|
+
- README
|
|
140
88
|
- Rakefile
|
|
89
|
+
- TODO
|
|
141
90
|
- bin/veewee
|
|
91
|
+
- gems/.gitignore
|
|
142
92
|
- iso/.gitignore
|
|
143
93
|
- lib/vagrant_init.rb
|
|
144
94
|
- lib/veewee.rb
|
|
145
95
|
- lib/veewee/command.rb
|
|
146
|
-
- lib/veewee/config.rb
|
|
147
96
|
- lib/veewee/export.rb
|
|
148
97
|
- lib/veewee/scancode.rb
|
|
149
98
|
- lib/veewee/session.rb
|
|
@@ -176,6 +125,7 @@ files:
|
|
|
176
125
|
- templates/ubuntu-10.10-server-i386/postinstall.sh
|
|
177
126
|
- templates/ubuntu-10.10-server-i386/postinstall2.sh
|
|
178
127
|
- templates/ubuntu-10.10-server-i386/preseed.cfg
|
|
128
|
+
- tmp/.gitignore
|
|
179
129
|
- trials/docu-vbox.txt
|
|
180
130
|
- trials/f.rb
|
|
181
131
|
- trials/t.rb
|
|
@@ -194,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
194
144
|
requirements:
|
|
195
145
|
- - ">="
|
|
196
146
|
- !ruby/object:Gem::Version
|
|
197
|
-
hash:
|
|
147
|
+
hash: 1588562477501260201
|
|
198
148
|
segments:
|
|
199
149
|
- 0
|
|
200
150
|
version: "0"
|
|
@@ -203,15 +153,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
203
153
|
requirements:
|
|
204
154
|
- - ">="
|
|
205
155
|
- !ruby/object:Gem::Version
|
|
206
|
-
segments:
|
|
207
|
-
- 1
|
|
208
|
-
- 3
|
|
209
|
-
- 6
|
|
210
156
|
version: 1.3.6
|
|
211
157
|
requirements: []
|
|
212
158
|
|
|
213
159
|
rubyforge_project: veewee
|
|
214
|
-
rubygems_version: 1.
|
|
160
|
+
rubygems_version: 1.5.0
|
|
215
161
|
signing_key:
|
|
216
162
|
specification_version: 3
|
|
217
163
|
summary: Vagrant box creation
|