vagrant-serial 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vagrant::Serial
2
2
 
3
- Vagrant::Serial allows to configure serial ports forwarding with Vagrant.
3
+ Vagrant::Serial allows you to configure serial ports forwarding with Vagrant.
4
4
  Tested with vagrant version 1.0.5.
5
5
 
6
6
  ## Installation
@@ -9,8 +9,9 @@ Tested with vagrant version 1.0.5.
9
9
 
10
10
  ## Configuration
11
11
 
12
- There is an restriction in VertualBox that you can use only 2 serial ports.
13
- So the basic `Vagrantfile` would look like this:
12
+ There is a restriction in VirtualBox that you can use only 2 serial ports.
13
+
14
+ The basic `Vagrantfile` will look like this:
14
15
 
15
16
  ```ruby
16
17
  Vagrant::Config.run do |config|
@@ -20,11 +21,15 @@ Vagrant::Config.run do |config|
20
21
  # Map COM2 port in virtual machine to 1025 port on the host
21
22
  config.serial.forward_com2 = 1025
22
23
 
23
- # Default: ~/.vagrant.d/serial
24
24
  # Override sockets path
25
+ # Default: ~/.vagrant.d/serial
25
26
  # config.serial.sockets_path = "/path/to/sockets/dir"
26
27
  end
27
28
  ```
28
29
 
30
+ ## Requirements
31
+ - Ubuntu or Debian Linux (or manually install /sbin/start-stop-daemon)
32
+ - /usr/bin/socat (use apt-get install socat for Ubuntu/Debian)
33
+
29
34
  ## Copyright
30
- Copyright (c) 2012 Anton Mironov and 7 Pikes, Inc.
35
+ Copyright (c) 2012 Anton Mironov, Alexey Zagarin and 7 Pikes, Inc.
@@ -9,8 +9,10 @@ require "fileutils"
9
9
 
10
10
  Vagrant.config_keys.register(:serial) { Vagrant::Serial::Config }
11
11
 
12
+ Vagrant.actions[:start].insert_after Vagrant::Action::VM::Customize, Vagrant::Serial::Middleware::ClearForwardedPorts
12
13
  Vagrant.actions[:start].insert_after Vagrant::Action::VM::Customize, Vagrant::Serial::Middleware::ConfigurePorts
13
14
  Vagrant.actions[:start].insert_after Vagrant::Action::VM::Boot, Vagrant::Serial::Middleware::ForwardPorts
15
+
14
16
  Vagrant.actions[:resume].insert_after Vagrant::Action::VM::Resume, Vagrant::Serial::Middleware::ForwardPorts
15
17
  Vagrant.actions[:halt].insert_after Vagrant::Action::VM::CheckAccessible, Vagrant::Serial::Middleware::ClearForwardedPorts
16
18
  Vagrant.actions[:suspend].insert_after Vagrant::Action::VM::CheckAccessible, Vagrant::Serial::Middleware::ClearForwardedPorts
@@ -7,18 +7,11 @@ module Vagrant
7
7
  end
8
8
 
9
9
  def call(env)
10
- if env[:vm].config.serial.set?
11
- FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if !File.directory?(env[:vm].config.serial.sockets_path)
10
+ FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if env[:vm].config.serial.set? && !File.directory?(env[:vm].config.serial.sockets_path)
12
11
 
13
- env[:ui].success "Stopping serial ports forwarding..."
14
- if env[:vm].config.serial.forward_com1
15
- `/sbin/start-stop-daemon --stop --quiet --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid --exec /usr/bin/socat && rm #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid`
16
- end
17
-
18
- if env[:vm].config.serial.forward_com2
19
- `/sbin/start-stop-daemon --stop --quiet --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid --exec /usr/bin/socat && rm #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid`
20
- end
21
- end
12
+ env[:ui].info "Stopping serial ports forwarding..."
13
+ `/sbin/start-stop-daemon --stop --oknodo --quiet --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid --exec /usr/bin/socat && rm -f #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid`
14
+ `/sbin/start-stop-daemon --stop --oknodo --quiet --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid --exec /usr/bin/socat && rm -f #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid`
22
15
 
23
16
  @app.call(env)
24
17
  end
@@ -10,6 +10,7 @@ module Vagrant
10
10
  if env[:vm].config.serial.set?
11
11
  FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if !File.directory?(env[:vm].config.serial.sockets_path)
12
12
 
13
+ env[:ui].info "Setting up serial ports..."
13
14
  if env[:vm].config.serial.forward_com1
14
15
  command = ["modifyvm", env[:vm].uuid, "--uart1", "0x3F8", "4", "--uartmode1", "server", "#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com1"]
15
16
  env[:vm].driver.execute_command(command)
@@ -12,12 +12,12 @@ module Vagrant
12
12
 
13
13
  if env[:vm].config.serial.forward_com1
14
14
  `/sbin/start-stop-daemon --quiet --start --pidfile #{env[:vm].config.serial.sockets_path}/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[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com1`
15
- env[:ui].success "COM1 => #{env[:vm].config.serial.forward_com1}"
15
+ env[:ui].info "COM1 => #{env[:vm].config.serial.forward_com1}"
16
16
  end
17
17
 
18
18
  if env[:vm].config.serial.forward_com2
19
19
  `/sbin/start-stop-daemon --quiet --start --pidfile #{env[:vm].config.serial.sockets_path}/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[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com2`
20
- env[:ui].success "COM2 => #{env[:vm].config.serial.forward_com2}"
20
+ env[:ui].info "COM2 => #{env[:vm].config.serial.forward_com2}"
21
21
  end
22
22
  end
23
23
 
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Serial
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
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: 1.0.0
4
+ version: 1.0.1
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-11-04 00:00:00.000000000 Z
12
+ date: 2012-11-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Vagrant plugin to configure serial-ports in vms
15
15
  email: