vagrant-winnfsd 1.0.11 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 876a25b5e8431573120608cd8d066a72f2b941f1
4
- data.tar.gz: 4b611c5a0edef4550814725208dd5cc888f0b95f
3
+ metadata.gz: d83623589bcd234eb662186435ce92b2f866d083
4
+ data.tar.gz: ad44d9b98594df521a9902741be1f7a902a492f9
5
5
  SHA512:
6
- metadata.gz: 432114baf7a5c9e73a36e5edfb70b7a013f0b579a50a8409fe70287b5cd37baa0891d35f0e2f0fe1b11b690886321a13c4d33af5684721cdbdfe2dce75a9dd73
7
- data.tar.gz: dd6316599a4c9c18d855f7a23a28b0a80b11a751d2735af33b6059f729e8ecdaf2a35653a43d479291668a43828d228d744bee985573e13531a8db58c2342280
6
+ metadata.gz: e1b2690df3a7d3b470f4efd7185b24fc52cf8cb8487d6b4d301d43d74680e362b97ef870afbb653fab5cdd61f4208e3a43effa3d62d59dd85ac0480d87f9d22e
7
+ data.tar.gz: 63b8b9be67d7f3efcc350f1090c44bbdfab9e56414491c3035b8845f7d8c0ebfd8e6151cea7d678f3f927b6e80a7fbd0b4f02d722ee0ab1ecb7f3191f3709bd9
data/CHANGELOG CHANGED
@@ -1,87 +1,92 @@
1
- CHANGELOG
2
- =========
3
-
4
- 1.0.11
5
- ------
6
-
7
- Update binary (contains many fixes from the winnfsd project, thanks to all contributors, especially to Yann Schepens)
8
-
9
-
10
- 1.0.10
11
- ------
12
-
13
- Fix issue if path contains space
14
-
15
-
16
- 1.0.9
17
- -----
18
-
19
- Update binary
20
- Change batch file for windows 8
21
-
22
-
23
- 1.0.8
24
- -----
25
-
26
- Correct typos
27
- Add logging parameter
28
-
29
-
30
- 1.0.7
31
- -----
32
-
33
- Add uid and gid support
34
- Add support for multiple boxes
35
-
36
-
37
- 1.0.6
38
- -----
39
-
40
- Add support for vagrant 1.5.0 and higher
41
- Remove support for vagrant lower than 1.5.0
42
- Improve error message
43
-
44
-
45
- 1.0.5
46
- -----
47
-
48
- Match vagrant documentation for activating nfs
49
-
50
-
51
- 1.0.4
52
- -----
53
-
54
- Improve batch file
55
- Update readme
56
- Update WinNFSd
57
-
58
-
59
- 1.0.3
60
- -----
61
-
62
- Move nfspaths file to .vagrant dir
63
-
64
-
65
- 1.0.2
66
- -----
67
-
68
- 2013-12-18
69
-
70
- Improve setting up of the firewall rules
71
-
72
-
73
- 1.0.1
74
- -----
75
-
76
- 2013-12-18
77
-
78
- Fix batch file
79
- Easy setup for the firewall rules
80
-
81
-
82
- 1.0.0
83
- -----
84
-
85
- 2013-12-12
86
-
1
+ CHANGELOG
2
+ =========
3
+
4
+ 1.1.0
5
+ ------
6
+
7
+ Update binary again (contains many fixes from the winnfsd project, thanks to all contributors, especially to Yann Schepens)
8
+
9
+ 1.0.11
10
+ ------
11
+
12
+ Update binary (contains many fixes from the winnfsd project, thanks to all contributors, especially to Yann Schepens)
13
+
14
+
15
+ 1.0.10
16
+ ------
17
+
18
+ Fix issue if path contains space
19
+
20
+
21
+ 1.0.9
22
+ -----
23
+
24
+ Update binary
25
+ Change batch file for windows 8
26
+
27
+
28
+ 1.0.8
29
+ -----
30
+
31
+ Correct typos
32
+ Add logging parameter
33
+
34
+
35
+ 1.0.7
36
+ -----
37
+
38
+ Add uid and gid support
39
+ Add support for multiple boxes
40
+
41
+
42
+ 1.0.6
43
+ -----
44
+
45
+ Add support for vagrant 1.5.0 and higher
46
+ Remove support for vagrant lower than 1.5.0
47
+ Improve error message
48
+
49
+
50
+ 1.0.5
51
+ -----
52
+
53
+ Match vagrant documentation for activating nfs
54
+
55
+
56
+ 1.0.4
57
+ -----
58
+
59
+ Improve batch file
60
+ Update readme
61
+ Update WinNFSd
62
+
63
+
64
+ 1.0.3
65
+ -----
66
+
67
+ Move nfspaths file to .vagrant dir
68
+
69
+
70
+ 1.0.2
71
+ -----
72
+
73
+ 2013-12-18
74
+
75
+ Improve setting up of the firewall rules
76
+
77
+
78
+ 1.0.1
79
+ -----
80
+
81
+ 2013-12-18
82
+
83
+ Fix batch file
84
+ Easy setup for the firewall rules
85
+
86
+
87
+ 1.0.0
88
+ -----
89
+
90
+ 2013-12-12
91
+
87
92
  First release
data/README.md CHANGED
@@ -1,53 +1,53 @@
1
- # Vagrant WinNFSd
2
-
3
- Manage and adds support for NFS on windows.
4
-
5
- ## Supported Platforms
6
-
7
- As of version 1.0.6 or later Vagrant 1.5 is required. For vagrant 1.4 please use the plugin version 1.0.5 or lower.
8
-
9
- Supported guests:
10
-
11
- * Linux
12
-
13
- ## Installation
14
-
15
- ```
16
- $ vagrant plugin install vagrant-winnfsd
17
- ```
18
-
19
- ## Activate NFS for vagrant
20
-
21
- To activate NFS for vagrant see: http://docs.vagrantup.com/v2/synced-folders/nfs.html
22
-
23
- The plugin extends vagrant in the way that you can use NFS also with windows. So the following hint on the vagrant documentation page is no longer true:
24
-
25
- ```
26
- Windows users: NFS folders do not work on Windows hosts. Vagrant will ignore your request for NFS synced folders on Windows.
27
- ```
28
-
29
- You will also need to declare some sort of network in order for NFS to work (the Virtualbox implied network will not work). Luckily this is easily done by adding the following line to your Vagrantfile:
30
-
31
- ```ruby
32
- # A private dhcp network is required for NFS to work (on Windows hosts, at least)
33
- config.vm.network "private_network", type: "dhcp"
34
- ```
35
-
36
- ## Settings
37
-
38
- ### Logging
39
-
40
- You activate the logging of the nfs daemon which will show the daemon window in the foreground. To activate the logging set the `config.winnfsd.logging` to `on`.
41
-
42
- ### Set uid and gid
43
-
44
- You can set the uid via the `config.winnfsd.uid` param and the gid via the `config.winnfsd.gid` param. Example:
45
-
46
- ```ruby
47
- Vagrant.configure('2') do |config|
48
- config.winnfsd.uid = 1
49
- config.winnfsd.gid = 1
50
- end
51
- ```
52
-
53
- Note that will be set global, that means the uid and gid is taken from the first box which starts the nfs daemon. If a box with an other uid or gid is started after that the option will be ignored.
1
+ # Vagrant WinNFSd
2
+
3
+ Manage and adds support for NFS on Windows.
4
+
5
+ ## Supported Platforms
6
+
7
+ As of version 1.0.6 or later Vagrant 1.5 is required. For Vagrant 1.4 please use the plugin version 1.0.5 or lower.
8
+
9
+ Supported guests:
10
+
11
+ * Linux
12
+
13
+ ## Installation
14
+
15
+ ```
16
+ $ vagrant plugin install vagrant-winnfsd
17
+ ```
18
+
19
+ ## Activate NFS for Vagrant
20
+
21
+ To activate NFS for Vagrant see: http://docs.vagrantup.com/v2/synced-folders/nfs.html
22
+
23
+ The plugin extends Vagrant in the way that you can use NFS also with Windows. So the following hint on the Vagrant documentation page is no longer true:
24
+
25
+ ```
26
+ Windows users: NFS folders do not work on Windows hosts. Vagrant will ignore your request for NFS synced folders on Windows.
27
+ ```
28
+
29
+ You will also need to declare some sort of network in order for NFS to work (the VirtualBox implied network will not work). Luckily this is easily done by adding the following line to your `Vagrantfile`:
30
+
31
+ ```ruby
32
+ # A private dhcp network is required for NFS to work (on Windows hosts, at least)
33
+ config.vm.network "private_network", type: "dhcp"
34
+ ```
35
+
36
+ ## Settings
37
+
38
+ ### Logging
39
+
40
+ You can activate the logging of the NFS daemon which will show the daemon window in the foreground. To activate the logging set the `config.winnfsd.logging` to `on`.
41
+
42
+ ### Set uid and gid
43
+
44
+ You can set the uid via the `config.winnfsd.uid` param and the gid via the `config.winnfsd.gid` param. Example:
45
+
46
+ ```ruby
47
+ Vagrant.configure('2') do |config|
48
+ config.winnfsd.uid = 1
49
+ config.winnfsd.gid = 1
50
+ end
51
+ ```
52
+
53
+ Note that will be set global, that means the uid and gid is taken from the first box which starts the NFS daemon. If a box with an other uid or gid is started after that the option will be ignored.
data/bin/nfsservice.bat CHANGED
@@ -1,57 +1,57 @@
1
- @echo off
2
-
3
- :: Fancy way to enable command extensions, where available
4
- :: http://technet.microsoft.com/en-us/library/bb491001.aspx OR http://www.robvanderwoude.com/allhelpw2ksp4_en.php#SETLOCAL
5
- verify other 2>nul
6
- setlocal enableextensions
7
- if errorlevel 1 echo Unable to enable command extensions
8
-
9
- for /f "tokens=1 delims= " %%y in ('tasklist /nh /fi "imagename eq winnfsd.exe"') do @set result=%%y
10
-
11
- CALL :LoCase %result
12
-
13
- if %1==status (
14
- echo|set /p=[NFS] Status:
15
-
16
- if "%result%"=="winnfsd.exe" (
17
- echo running
18
- exit 0
19
- ) else (
20
- echo halted
21
- exit 1
22
- )
23
- )
24
-
25
- if %1==start (
26
- echo|set /p=[NFS] Start:
27
-
28
- if "%result%"=="winnfsd.exe" (
29
- echo already running
30
- ) else (
31
- start "" "%~dp0winnfsd" -log %2 -pathFile %3 -id %4 %5
32
- echo started
33
- )
34
-
35
- exit 0
36
- )
37
-
38
- if %1==halt (
39
- echo|set /p=[NFS] Halt:
40
-
41
- if "%result%"=="winnfsd.exe" (
42
- taskkill /f /im "winnfsd.exe" >nul
43
- echo halt
44
- ) else (
45
- echo not running
46
- )
47
-
48
- exit 0
49
- )
50
-
51
- exit 1
52
-
53
- :LoCase
54
- :: Subroutine to convert a variable VALUE to all lower case.
55
- :: The argument for this subroutine is the variable NAME.
56
- FOR %%i IN ("A=a" "B=b" "C=c" "D=d" "E=e" "F=f" "G=g" "H=h" "I=i" "J=j" "K=k" "L=l" "M=m" "N=n" "O=o" "P=p" "Q=q" "R=r" "S=s" "T=t" "U=u" "V=v" "W=w" "X=x" "Y=y" "Z=z") DO CALL SET "%1=%%%1:%%~i%%"
1
+ @echo off
2
+
3
+ :: Fancy way to enable command extensions, where available
4
+ :: http://technet.microsoft.com/en-us/library/bb491001.aspx OR http://www.robvanderwoude.com/allhelpw2ksp4_en.php#SETLOCAL
5
+ verify other 2>nul
6
+ setlocal enableextensions
7
+ if errorlevel 1 echo Unable to enable command extensions
8
+
9
+ for /f "tokens=1 delims= " %%y in ('tasklist /nh /fi "imagename eq winnfsd.exe"') do @set result=%%y
10
+
11
+ CALL :LoCase %result
12
+
13
+ if %1==status (
14
+ echo|set /p=[NFS] Status:
15
+
16
+ if "%result%"=="winnfsd.exe" (
17
+ echo running
18
+ exit 0
19
+ ) else (
20
+ echo halted
21
+ exit 1
22
+ )
23
+ )
24
+
25
+ if %1==start (
26
+ echo|set /p=[NFS] Start:
27
+
28
+ if "%result%"=="winnfsd.exe" (
29
+ echo already running
30
+ ) else (
31
+ start "" "%~dp0winnfsd" -log %2 -pathFile %3 -id %4 %5
32
+ echo started
33
+ )
34
+
35
+ exit 0
36
+ )
37
+
38
+ if %1==halt (
39
+ echo|set /p=[NFS] Halt:
40
+
41
+ if "%result%"=="winnfsd.exe" (
42
+ taskkill /f /im "winnfsd.exe" >nul
43
+ echo halt
44
+ ) else (
45
+ echo not running
46
+ )
47
+
48
+ exit 0
49
+ )
50
+
51
+ exit 1
52
+
53
+ :LoCase
54
+ :: Subroutine to convert a variable VALUE to all lower case.
55
+ :: The argument for this subroutine is the variable NAME.
56
+ FOR %%i IN ("A=a" "B=b" "C=c" "D=d" "E=e" "F=f" "G=g" "H=h" "I=i" "J=j" "K=k" "L=l" "M=m" "N=n" "O=o" "P=p" "Q=q" "R=r" "S=s" "T=t" "U=u" "V=v" "W=w" "X=x" "Y=y" "Z=z") DO CALL SET "%1=%%%1:%%~i%%"
57
57
  GOTO:EOF
data/bin/winnfsd.exe CHANGED
Binary file
@@ -1,107 +1,107 @@
1
- require Vagrant.source_root.join('plugins/hosts/windows/cap/nfs')
2
-
3
- module VagrantWinNFSd
4
- module Cap
5
- class NFS < Vagrant.plugin('2', :host)
6
- @logger = Log4r::Logger.new('vagrant::hosts::windows')
7
-
8
- executable = VagrantWinNFSd.get_path_for_file('nfsservice.bat')
9
- @nfs_check_command = "\"#{executable}\" status"
10
- @nfs_start_command = "\"#{executable}\" start"
11
- @nfs_stop_command = "\"#{executable}\" halt"
12
- @nfs_path_file = "#{Vagrant.source_root}/nfspaths"
13
-
14
- def self.nfs_export(env, ui, id, ips, folders)
15
- ui.info I18n.t('vagrant_winnfsd.hosts.windows.nfs_export')
16
- sleep 0.5
17
-
18
- self.nfs_cleanup(id)
19
- nfs_file_lines = []
20
-
21
- nfs_file_lines.push("# VAGRANT-BEGIN: #{Process.uid} #{id}")
22
- folders.each do |k, opts|
23
- hostpath = opts[:hostpath].dup
24
- hostpath.gsub!("'", "'\\\\''")
25
- hostpath.gsub('/', '\\')
26
- nfs_file_lines.push("#{hostpath}")
27
- end
28
- nfs_file_lines.push("# VAGRANT-END: #{Process.uid} #{id}")
29
-
30
- File.open(@nfs_path_file, 'a') do |f|
31
- f.puts(nfs_file_lines)
32
- end
33
-
34
-
35
-
36
- unless self.nfs_running?
37
- gid = env.vagrantfile.config.winnfsd.gid
38
- uid = env.vagrantfile.config.winnfsd.uid
39
- logging = env.vagrantfile.config.winnfsd.logging
40
- system("#{@nfs_start_command} #{logging} \"#{@nfs_path_file}\" #{uid} #{gid}")
41
- sleep 2
42
- end
43
- end
44
-
45
- def self.nfs_prune(environment, ui, valid_ids)
46
- return unless File.exist?(@nfs_path_file)
47
-
48
- @logger.info('Pruning invalid NFS entries...')
49
-
50
- output = false
51
- user = Process.uid
52
-
53
- File.read(@nfs_path_file).lines.each do |line|
54
- id = line[/^# VAGRANT-BEGIN:( #{user})? ([A-Za-z0-9-]+?)$/, 2]
55
-
56
- if id
57
- if valid_ids.include?(id)
58
- @logger.debug("Valid ID: #{id}")
59
- else
60
- unless output
61
- # We want to warn the user but we only want to output once
62
- ui.info I18n.t('vagrant_winnfsd.hosts.windows.nfs_prune')
63
- output = true
64
- end
65
-
66
- @logger.info("Invalid ID, pruning: #{id}")
67
- self.nfs_cleanup(id)
68
- end
69
- end
70
- end
71
- end
72
-
73
- def self.nfs_installed(environment)
74
- true
75
- end
76
-
77
- protected
78
-
79
- def self.nfs_running?
80
- system("#{@nfs_check_command}")
81
- end
82
-
83
- def self.nfs_cleanup(id)
84
- return unless File.exist?(@nfs_path_file)
85
-
86
- user = Regexp.escape(Process.uid.to_s)
87
- id = Regexp.escape(id.to_s)
88
- skip = false
89
- new_file_lines = []
90
-
91
- File.read(@nfs_path_file).lines.each do |line|
92
- if line[/^# VAGRANT-BEGIN: #{user} #{id}$/]
93
- skip = true
94
- elsif line[/^# VAGRANT-END: #{user} #{id}$/]
95
- skip = false
96
- elsif !skip
97
- new_file_lines.push(line)
98
- end
99
- end
100
-
101
- File.open(@nfs_path_file, 'w+') do |f|
102
- f.puts(new_file_lines)
103
- end
104
- end
105
- end
106
- end
107
- end
1
+ require Vagrant.source_root.join('plugins/hosts/windows/cap/nfs')
2
+
3
+ module VagrantWinNFSd
4
+ module Cap
5
+ class NFS < Vagrant.plugin('2', :host)
6
+ @logger = Log4r::Logger.new('vagrant::hosts::windows')
7
+
8
+ executable = VagrantWinNFSd.get_path_for_file('nfsservice.bat')
9
+ @nfs_check_command = "\"#{executable}\" status"
10
+ @nfs_start_command = "\"#{executable}\" start"
11
+ @nfs_stop_command = "\"#{executable}\" halt"
12
+ @nfs_path_file = "#{Vagrant.source_root}/nfspaths"
13
+
14
+ def self.nfs_export(env, ui, id, ips, folders)
15
+ ui.info I18n.t('vagrant_winnfsd.hosts.windows.nfs_export')
16
+ sleep 0.5
17
+
18
+ self.nfs_cleanup(id)
19
+ nfs_file_lines = []
20
+
21
+ nfs_file_lines.push("# VAGRANT-BEGIN: #{Process.uid} #{id}")
22
+ folders.each do |k, opts|
23
+ hostpath = opts[:hostpath].dup
24
+ hostpath.gsub!("'", "'\\\\''")
25
+ hostpath.gsub('/', '\\')
26
+ nfs_file_lines.push("#{hostpath}")
27
+ end
28
+ nfs_file_lines.push("# VAGRANT-END: #{Process.uid} #{id}")
29
+
30
+ File.open(@nfs_path_file, 'a') do |f|
31
+ f.puts(nfs_file_lines)
32
+ end
33
+
34
+
35
+
36
+ unless self.nfs_running?
37
+ gid = env.vagrantfile.config.winnfsd.gid
38
+ uid = env.vagrantfile.config.winnfsd.uid
39
+ logging = env.vagrantfile.config.winnfsd.logging
40
+ system("#{@nfs_start_command} #{logging} \"#{@nfs_path_file}\" #{uid} #{gid}")
41
+ sleep 2
42
+ end
43
+ end
44
+
45
+ def self.nfs_prune(environment, ui, valid_ids)
46
+ return unless File.exist?(@nfs_path_file)
47
+
48
+ @logger.info('Pruning invalid NFS entries...')
49
+
50
+ output = false
51
+ user = Process.uid
52
+
53
+ File.read(@nfs_path_file).lines.each do |line|
54
+ id = line[/^# VAGRANT-BEGIN:( #{user})? ([A-Za-z0-9-]+?)$/, 2]
55
+
56
+ if id
57
+ if valid_ids.include?(id)
58
+ @logger.debug("Valid ID: #{id}")
59
+ else
60
+ unless output
61
+ # We want to warn the user but we only want to output once
62
+ ui.info I18n.t('vagrant_winnfsd.hosts.windows.nfs_prune')
63
+ output = true
64
+ end
65
+
66
+ @logger.info("Invalid ID, pruning: #{id}")
67
+ self.nfs_cleanup(id)
68
+ end
69
+ end
70
+ end
71
+ end
72
+
73
+ def self.nfs_installed(environment)
74
+ true
75
+ end
76
+
77
+ protected
78
+
79
+ def self.nfs_running?
80
+ system("#{@nfs_check_command}")
81
+ end
82
+
83
+ def self.nfs_cleanup(id)
84
+ return unless File.exist?(@nfs_path_file)
85
+
86
+ user = Regexp.escape(Process.uid.to_s)
87
+ id = Regexp.escape(id.to_s)
88
+ skip = false
89
+ new_file_lines = []
90
+
91
+ File.read(@nfs_path_file).lines.each do |line|
92
+ if line[/^# VAGRANT-BEGIN: #{user} #{id}$/]
93
+ skip = true
94
+ elsif line[/^# VAGRANT-END: #{user} #{id}$/]
95
+ skip = false
96
+ elsif !skip
97
+ new_file_lines.push(line)
98
+ end
99
+ end
100
+
101
+ File.open(@nfs_path_file, 'w+') do |f|
102
+ f.puts(new_file_lines)
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
@@ -1,33 +1,33 @@
1
- require 'vagrant'
2
-
3
- module VagrantWinNFSd
4
- module Config
5
- class WinNFSd < Vagrant.plugin('2', :config)
6
- attr_accessor :logging
7
- attr_accessor :uid
8
- attr_accessor :gid
9
-
10
- def initialize
11
- @logging = UNSET_VALUE
12
- @uid = UNSET_VALUE
13
- @gid = UNSET_VALUE
14
- end
15
-
16
- def validate(machine)
17
- errors = []
18
-
19
- errors << 'winnfsd.logging cannot only be \'on\' or \'off\'.' unless (machine.config.winnfsd.logging == 'on' || machine.config.winnfsd.logging == 'off')
20
- errors << 'winnfsd.uid cannot be nil.' if machine.config.winnfsd.uid.nil?
21
- errors << 'winnfsd.gid cannot be nil.' if machine.config.winnfsd.gid.nil?
22
-
23
- { "WinNFSd" => errors }
24
- end
25
-
26
- def finalize!
27
- @logging = 'off' if @logging == UNSET_VALUE
28
- @uid = 0 if @uid == UNSET_VALUE
29
- @gid = 0 if @gid == UNSET_VALUE
30
- end
31
- end
32
- end
33
- end
1
+ require 'vagrant'
2
+
3
+ module VagrantWinNFSd
4
+ module Config
5
+ class WinNFSd < Vagrant.plugin('2', :config)
6
+ attr_accessor :logging
7
+ attr_accessor :uid
8
+ attr_accessor :gid
9
+
10
+ def initialize
11
+ @logging = UNSET_VALUE
12
+ @uid = UNSET_VALUE
13
+ @gid = UNSET_VALUE
14
+ end
15
+
16
+ def validate(machine)
17
+ errors = []
18
+
19
+ errors << 'winnfsd.logging cannot only be \'on\' or \'off\'.' unless (machine.config.winnfsd.logging == 'on' || machine.config.winnfsd.logging == 'off')
20
+ errors << 'winnfsd.uid cannot be nil.' if machine.config.winnfsd.uid.nil?
21
+ errors << 'winnfsd.gid cannot be nil.' if machine.config.winnfsd.gid.nil?
22
+
23
+ { "WinNFSd" => errors }
24
+ end
25
+
26
+ def finalize!
27
+ @logging = 'off' if @logging == UNSET_VALUE
28
+ @uid = 0 if @uid == UNSET_VALUE
29
+ @gid = 0 if @gid == UNSET_VALUE
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,80 +1,80 @@
1
- begin
2
- require 'vagrant'
3
- rescue LoadError
4
- raise "The Vagrant WinNFSd plugin must be run within Vagrant."
5
- end
6
-
7
- if Vagrant::VERSION < "1.5.0"
8
- raise "The Vagrant AWS plugin is only compatible with Vagrant 1.5.0+"
9
- end
10
-
11
-
12
- module VagrantWinNFSd
13
- class Plugin < Vagrant.plugin('2')
14
- name 'WinNFSd'
15
-
16
- description <<-DESC
17
- This plugin adds NFS support on Windows for Vagrant.
18
- DESC
19
-
20
- action_hook(:init_i18n, :environment_load) { init_plugin }
21
-
22
- config('vm') do
23
- require_relative 'config/config'
24
- @config = VagrantWinNFSd::Config::Config
25
- end
26
-
27
- config(:winnfsd) do
28
- require_relative 'config/winnfsd'
29
- VagrantWinNFSd::Config::WinNFSd
30
- end
31
-
32
- synced_folder('nfs') do
33
- require_relative 'synced_folder'
34
- VagrantWinNFSd::SyncedFolder
35
- end
36
-
37
- host_capability('windows', 'nfs_export') do
38
- require_relative 'cap/nfs'
39
- Cap::NFS
40
- end
41
-
42
- host_capability('windows', 'nfs_installed') do
43
- require_relative 'cap/nfs'
44
- Cap::NFS
45
- end
46
-
47
- host_capability('windows', 'nfs_prune') do
48
- require_relative 'cap/nfs'
49
- Cap::NFS
50
- end
51
-
52
- def self.init_plugin
53
- I18n.load_path << File.expand_path('locales/en.yml', VagrantWinNFSd.source_root)
54
- I18n.reload!
55
-
56
- rule_name = 'VagrantWinNFSd-'.concat(VagrantWinNFSd::VERSION)
57
- program = VagrantWinNFSd.get_path_for_file("winnfsd.exe")
58
- rule_exist = "netsh advfirewall firewall show rule name=\"%s\">nul"
59
-
60
- unless system(sprintf(rule_exist, rule_name))
61
- cleanup_rule = "advfirewall firewall delete rule name=\"winnfsd.exe\""
62
- rule = "advfirewall firewall add rule name=\"%s\" dir=\"%s\" action=allow protocol=any program=\"%s\" profile=any"
63
- in_rule = sprintf(rule, rule_name, 'in', program)
64
- out_rule = sprintf(rule, rule_name, 'out', program)
65
- xp_rule = "netsh firewall add allowedprogram \"#{program}\" #{rule_name} ENABLE"
66
-
67
- firewall_script = VagrantWinNFSd.get_path_for_file('setupfirewall.vbs')
68
- firewall_rule = "cscript //nologo #{firewall_script} \"#{cleanup_rule}\" \"#{in_rule}\" \"#{out_rule}\""
69
-
70
- unless system(firewall_rule)
71
- puts I18n.t('vagrant_winnfsd.firewall.error')
72
- puts "netsh #{in_rule}\n"
73
- puts "netsh #{out_rule}\n"
74
- puts I18n.t('vagrant_winnfsd.firewall.xp_error')
75
- puts xp_rule
76
- end
77
- end
78
- end
79
- end
80
- end
1
+ begin
2
+ require 'vagrant'
3
+ rescue LoadError
4
+ raise "The Vagrant WinNFSd plugin must be run within Vagrant."
5
+ end
6
+
7
+ if Vagrant::VERSION < "1.5.0"
8
+ raise "The Vagrant WinNFSd plugin is only compatible with Vagrant 1.5.0+"
9
+ end
10
+
11
+
12
+ module VagrantWinNFSd
13
+ class Plugin < Vagrant.plugin('2')
14
+ name 'WinNFSd'
15
+
16
+ description <<-DESC
17
+ This plugin adds NFS support on Windows for Vagrant.
18
+ DESC
19
+
20
+ action_hook(:init_i18n, :environment_load) { init_plugin }
21
+
22
+ config('vm') do
23
+ require_relative 'config/config'
24
+ @config = VagrantWinNFSd::Config::Config
25
+ end
26
+
27
+ config(:winnfsd) do
28
+ require_relative 'config/winnfsd'
29
+ VagrantWinNFSd::Config::WinNFSd
30
+ end
31
+
32
+ synced_folder('nfs') do
33
+ require_relative 'synced_folder'
34
+ VagrantWinNFSd::SyncedFolder
35
+ end
36
+
37
+ host_capability('windows', 'nfs_export') do
38
+ require_relative 'cap/nfs'
39
+ Cap::NFS
40
+ end
41
+
42
+ host_capability('windows', 'nfs_installed') do
43
+ require_relative 'cap/nfs'
44
+ Cap::NFS
45
+ end
46
+
47
+ host_capability('windows', 'nfs_prune') do
48
+ require_relative 'cap/nfs'
49
+ Cap::NFS
50
+ end
51
+
52
+ def self.init_plugin
53
+ I18n.load_path << File.expand_path('locales/en.yml', VagrantWinNFSd.source_root)
54
+ I18n.reload!
55
+
56
+ rule_name = 'VagrantWinNFSd-'.concat(VagrantWinNFSd::VERSION)
57
+ program = VagrantWinNFSd.get_path_for_file("winnfsd.exe")
58
+ rule_exist = "netsh advfirewall firewall show rule name=\"%s\">nul"
59
+
60
+ unless system(sprintf(rule_exist, rule_name))
61
+ cleanup_rule = "advfirewall firewall delete rule name=\"winnfsd.exe\""
62
+ rule = "advfirewall firewall add rule name=\"%s\" dir=\"%s\" action=allow protocol=any program=\"%s\" profile=any"
63
+ in_rule = sprintf(rule, rule_name, 'in', program)
64
+ out_rule = sprintf(rule, rule_name, 'out', program)
65
+ xp_rule = "netsh firewall add allowedprogram \"#{program}\" #{rule_name} ENABLE"
66
+
67
+ firewall_script = VagrantWinNFSd.get_path_for_file('setupfirewall.vbs')
68
+ firewall_rule = "cscript //nologo #{firewall_script} \"#{cleanup_rule}\" \"#{in_rule}\" \"#{out_rule}\""
69
+
70
+ unless system(firewall_rule)
71
+ puts I18n.t('vagrant_winnfsd.firewall.error')
72
+ puts "netsh #{in_rule}\n"
73
+ puts "netsh #{out_rule}\n"
74
+ puts I18n.t('vagrant_winnfsd.firewall.xp_error')
75
+ puts xp_rule
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -1,4 +1,4 @@
1
-
2
- module VagrantWinNFSd
3
- VERSION = '1.0.11'
4
- end
1
+
2
+ module VagrantWinNFSd
3
+ VERSION = '1.1.0'
4
+ end
data/locales/en.yml CHANGED
@@ -1,15 +1,15 @@
1
- ---
2
- en:
3
- vagrant_winnfsd:
4
- hosts:
5
- windows:
6
- nfs_export: |-
7
- Preparing to edit nfs mounting file.
8
- nfs_prune: |-
9
- Pruning invalid NFS exports.
10
- firewall:
11
- error: |-
12
- It seems that you don't have the privileges to change the firewall rules. NFS will not work without that firewall
13
- changes. Execute the following commands via cmd as administrator:
14
- xp_error: |-
15
- If you are an Windows XP user run the following command instead:
1
+ ---
2
+ en:
3
+ vagrant_winnfsd:
4
+ hosts:
5
+ windows:
6
+ nfs_export: |-
7
+ Preparing to edit nfs mounting file.
8
+ nfs_prune: |-
9
+ Pruning invalid NFS exports.
10
+ firewall:
11
+ error: |-
12
+ It seems that you don't have the privileges to change the firewall rules. NFS will not work without that firewall
13
+ changes. Execute the following commands via cmd as administrator:
14
+ xp_error: |-
15
+ If you are an Windows XP user run the following command instead:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-winnfsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Schneider
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-29 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Manage and adds support for NFS on windows.
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.2.2
59
+ rubygems_version: 2.4.8
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: Adds NFS support for Windows