vagrant-winnfsd 1.0.7 → 1.0.8
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.
- checksums.yaml +4 -4
- data/CHANGELOG +67 -60
- data/README.md +45 -39
- data/bin/nfsservice.bat +56 -56
- data/lib/vagrant-winnfsd/cap/nfs.rb +107 -106
- data/lib/vagrant-winnfsd/config/winnfsd.rb +10 -6
- data/lib/vagrant-winnfsd/plugin.rb +80 -77
- data/lib/vagrant-winnfsd/version.rb +4 -4
- data/locales/en.yml +15 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e1a88a34650a6ccd9e2d1c97fcf89f07910a0d
|
4
|
+
data.tar.gz: aa57e0f5fd536d1b36bde10d67a9985cc861406f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77a3d93504eae169caa01ba6857364c02ca4a4c82a2d1573ccb8b57eac05c699b027750d14dff5a26a2a31c628d53d50469638ed3c43b4619b4b632b03d604e5
|
7
|
+
data.tar.gz: 477dbc9cafe469b0f6264536deed1577ba83d5bb53f431bb3ff9361d323efae8c341b8eb3311117bfb810c7ae08adfda514a0a42fbe373c087391d7072b6e881
|
data/CHANGELOG
CHANGED
@@ -1,61 +1,68 @@
|
|
1
|
-
CHANGELOG
|
2
|
-
=========
|
3
|
-
|
4
|
-
1.0.
|
5
|
-
-----
|
6
|
-
|
7
|
-
|
8
|
-
Add
|
9
|
-
|
10
|
-
|
11
|
-
1.0.
|
12
|
-
-----
|
13
|
-
|
14
|
-
Add
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
1
|
+
CHANGELOG
|
2
|
+
=========
|
3
|
+
|
4
|
+
1.0.8
|
5
|
+
-----
|
6
|
+
|
7
|
+
Correct typos
|
8
|
+
Add logging parameter
|
9
|
+
|
10
|
+
|
11
|
+
1.0.7
|
12
|
+
-----
|
13
|
+
|
14
|
+
Add uid and gid support
|
15
|
+
Add support for multiple boxes
|
16
|
+
|
17
|
+
|
18
|
+
1.0.6
|
19
|
+
-----
|
20
|
+
|
21
|
+
Add support for vagrant 1.5.0 and higher
|
22
|
+
Remove support for vagrant lower than 1.5.0
|
23
|
+
Improve error message
|
24
|
+
|
25
|
+
|
26
|
+
1.0.5
|
27
|
+
-----
|
28
|
+
|
29
|
+
Match vagrant documentation for activating nfs
|
30
|
+
|
31
|
+
|
32
|
+
1.0.4
|
33
|
+
-----
|
34
|
+
|
35
|
+
Improve batch file
|
36
|
+
Update readme
|
37
|
+
Update WinNFSd
|
38
|
+
|
39
|
+
|
40
|
+
1.0.3
|
41
|
+
-----
|
42
|
+
|
43
|
+
Move nfspaths file to .vagrant dir
|
44
|
+
|
45
|
+
|
46
|
+
1.0.2
|
47
|
+
-----
|
48
|
+
|
49
|
+
2013-12-18
|
50
|
+
|
51
|
+
Improve setting up of the firewall rules
|
52
|
+
|
53
|
+
|
54
|
+
1.0.1
|
55
|
+
-----
|
56
|
+
|
57
|
+
2013-12-18
|
58
|
+
|
59
|
+
Fix batch file
|
60
|
+
Easy setup for the firewall rules
|
61
|
+
|
62
|
+
|
63
|
+
1.0.0
|
64
|
+
-----
|
65
|
+
|
66
|
+
2013-12-12
|
67
|
+
|
61
68
|
First release
|
data/README.md
CHANGED
@@ -1,40 +1,46 @@
|
|
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
|
-
## Settings
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
+
## Settings
|
30
|
+
|
31
|
+
### Logging
|
32
|
+
|
33
|
+
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`.
|
34
|
+
|
35
|
+
### Set uid and gid
|
36
|
+
|
37
|
+
You can set the uid via the `config.winnfsd.uid` param and the gid via the `config.winnfsd.gid` param. Example:
|
38
|
+
|
39
|
+
```
|
40
|
+
Vagrant.configure('2') do |config|
|
41
|
+
config.winnfsd.uid = 1
|
42
|
+
config.winnfsd.gid = 1
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
40
46
|
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
|
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
|
@@ -1,106 +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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
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
|
@@ -3,26 +3,30 @@ require 'vagrant'
|
|
3
3
|
module VagrantWinNFSd
|
4
4
|
module Config
|
5
5
|
class WinNFSd < Vagrant.plugin('2', :config)
|
6
|
+
attr_accessor :logging
|
6
7
|
attr_accessor :uid
|
7
8
|
attr_accessor :gid
|
8
9
|
|
9
10
|
def initialize
|
10
|
-
@
|
11
|
-
@
|
11
|
+
@logging = UNSET_VALUE
|
12
|
+
@uid = UNSET_VALUE
|
13
|
+
@gid = UNSET_VALUE
|
12
14
|
end
|
13
15
|
|
14
16
|
def validate(machine)
|
15
17
|
errors = []
|
16
18
|
|
17
|
-
errors << 'winnfsd.
|
18
|
-
errors << 'winnfsd.
|
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?
|
19
22
|
|
20
23
|
{ "WinNFSd" => errors }
|
21
24
|
end
|
22
25
|
|
23
26
|
def finalize!
|
24
|
-
@
|
25
|
-
@
|
27
|
+
@logging = 'off' if @logging == UNSET_VALUE
|
28
|
+
@uid = 0 if @uid == UNSET_VALUE
|
29
|
+
@gid = 0 if @gid == UNSET_VALUE
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
@@ -1,77 +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
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
puts
|
72
|
-
puts "netsh #{
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
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 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,4 +1,4 @@
|
|
1
|
-
|
2
|
-
module VagrantWinNFSd
|
3
|
-
VERSION = '1.0.
|
4
|
-
end
|
1
|
+
|
2
|
+
module VagrantWinNFSd
|
3
|
+
VERSION = '1.0.8'
|
4
|
+
end
|
data/locales/en.yml
CHANGED
@@ -1,13 +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
|
13
|
-
changes. Execute the following
|
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.
|
4
|
+
version: 1.0.8
|
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-06-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Manage and adds support for NFS on windows.
|