vagrant-serial 0.0.11 → 0.0.12
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/README.md +0 -2
- data/lib/vagrant-serial/config.rb +13 -0
- data/lib/vagrant-serial/middleware/clear_forwarded_ports.rb +8 -2
- data/lib/vagrant-serial/middleware/configure_ports.rb +10 -4
- data/lib/vagrant-serial/middleware/forward_ports.rb +8 -2
- data/lib/vagrant-serial/version.rb +1 -1
- data/lib/vagrant-serial.rb +3 -0
- metadata +3 -2
data/README.md
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Serial
|
3
|
+
class Config < Vagrant::Config::Base
|
4
|
+
attr_accessor :forward_com1
|
5
|
+
attr_accessor :forward_com2
|
6
|
+
|
7
|
+
def validate(env, errors)
|
8
|
+
errors.add("Host port for com1 forwarding couldn't be below 1024.") if forward_com1 && forward_com1.to_i < 1024
|
9
|
+
errors.add("Host port for com2 forwarding couldn't be below 1024.") if forward_com2 && forward_com2.to_i < 1024
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -7,8 +7,14 @@ module Vagrant
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
-
|
11
|
-
|
10
|
+
if env[:vm].config.serial.forward_com1
|
11
|
+
`/sbin/start-stop-daemon --stop --quiet --pidfile #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com1.pid --exec /usr/bin/socat && rm #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com1.pid`
|
12
|
+
end
|
13
|
+
|
14
|
+
if env[:vm].config.serial.forward_com2
|
15
|
+
`/sbin/start-stop-daemon --stop --quiet --pidfile #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com2.pid --exec /usr/bin/socat && rm #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com2.pid`
|
16
|
+
end
|
17
|
+
|
12
18
|
@app.call(env)
|
13
19
|
end
|
14
20
|
end
|
@@ -7,10 +7,16 @@ module Vagrant
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
if env[:vm].config.serial.forward_com1
|
11
|
+
command = ["modifyvm", env[:vm].uuid, "--uart1", "0x3F8", "4", "--uartmode1", "server", "#{ENV['HOME']}/serial/#{env[:vm].uuid}-com1"]
|
12
|
+
env[:vm].driver.execute_command(command)
|
13
|
+
end
|
14
|
+
|
15
|
+
if env[:vm].config.serial.forward_com2
|
16
|
+
command = ["modifyvm", env[:vm].uuid, "--uart2", "0x2F8", "3", "--uartmode2", "server", "#{ENV['HOME']}/serial/#{env[:vm].uuid}-com2"]
|
17
|
+
env[:vm].driver.execute_command(command)
|
18
|
+
end
|
19
|
+
|
14
20
|
@app.call(env)
|
15
21
|
end
|
16
22
|
end
|
@@ -7,8 +7,14 @@ module Vagrant
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
-
|
11
|
-
|
10
|
+
if env[:vm].config.serial.forward_com1
|
11
|
+
`/sbin/start-stop-daemon --quiet --start --pidfile #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com1.pid --background --make-pidfile --exec /usr/bin/socat -- tcp-l:#{env[:vm].config.serial.forward_com1},reuseaddr,fork UNIX-CONNECT:#{ENV['HOME']}/serial/#{env[:vm].uuid}-com1`
|
12
|
+
end
|
13
|
+
|
14
|
+
if env[:vm].config.serial.forward_com2
|
15
|
+
`/sbin/start-stop-daemon --quiet --start --pidfile #{ENV['HOME']}/serial/socat.#{env[:vm].uuid}-com2.pid --background --make-pidfile --exec /usr/bin/socat -- tcp-l:#{env[:vm].config.serial.forward_com2},reuseaddr,fork UNIX-CONNECT:#{ENV['HOME']}/serial/#{env[:vm].uuid}-com2`
|
16
|
+
end
|
17
|
+
|
12
18
|
@app.call(env)
|
13
19
|
end
|
14
20
|
end
|
data/lib/vagrant-serial.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
require "vagrant"
|
2
|
+
require "vagrant-serial/config"
|
2
3
|
require "vagrant-serial/version"
|
3
4
|
require "vagrant-serial/middleware/configure_ports"
|
4
5
|
require "vagrant-serial/middleware/forward_ports"
|
5
6
|
require "vagrant-serial/middleware/clear_forwarded_ports"
|
6
7
|
|
8
|
+
Vagrant.config_keys.register(:serial) { Vagrant::Serial::Config }
|
9
|
+
|
7
10
|
Vagrant.actions[:start].insert_after Vagrant::Action::VM::Customize, Vagrant::Serial::Middleware::ConfigurePorts
|
8
11
|
Vagrant.actions[:start].insert_after Vagrant::Action::VM::Boot, Vagrant::Serial::Middleware::ForwardPorts
|
9
12
|
Vagrant.actions[:resume].insert_after Vagrant::Action::VM::Resume, Vagrant::Serial::Middleware::ForwardPorts
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-serial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Vagrant plugin to configure serial-ports in vms
|
15
15
|
email:
|
@@ -24,6 +24,7 @@ files:
|
|
24
24
|
- README.md
|
25
25
|
- Rakefile
|
26
26
|
- lib/vagrant-serial.rb
|
27
|
+
- lib/vagrant-serial/config.rb
|
27
28
|
- lib/vagrant-serial/middleware/clear_forwarded_ports.rb
|
28
29
|
- lib/vagrant-serial/middleware/configure_ports.rb
|
29
30
|
- lib/vagrant-serial/middleware/forward_ports.rb
|