vagrant-bindfs 0.4.14 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +66 -4
- data/Rakefile +11 -7
- data/Vagrantfile +10 -8
- data/lib/vagrant-bindfs.rb +10 -16
- data/lib/vagrant-bindfs/bindfs.rb +15 -0
- data/lib/vagrant-bindfs/bindfs/command.rb +47 -0
- data/lib/vagrant-bindfs/bindfs/folder.rb +38 -0
- data/lib/vagrant-bindfs/bindfs/option_definitions.json +67 -0
- data/lib/vagrant-bindfs/bindfs/option_set.rb +105 -0
- data/lib/vagrant-bindfs/bindfs/validators.rb +9 -0
- data/lib/vagrant-bindfs/bindfs/validators/config.rb +58 -0
- data/lib/vagrant-bindfs/bindfs/validators/runtime.rb +56 -0
- data/lib/vagrant-bindfs/vagrant.rb +12 -0
- data/lib/vagrant-bindfs/vagrant/actions.rb +11 -0
- data/lib/vagrant-bindfs/vagrant/actions/concerns.rb +11 -0
- data/lib/vagrant-bindfs/vagrant/actions/concerns/log.rb +34 -0
- data/lib/vagrant-bindfs/vagrant/actions/concerns/machine.rb +31 -0
- data/lib/vagrant-bindfs/vagrant/actions/installer.rb +99 -0
- data/lib/vagrant-bindfs/vagrant/actions/mounter.rb +65 -0
- data/lib/vagrant-bindfs/vagrant/capabilities.rb +108 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/all.rb +12 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/all/bindfs.rb +53 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/all/package_manager.rb +17 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/all/system_checks.rb +20 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/darwin.rb +13 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/darwin/bindfs.rb +33 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/darwin/fuse.rb +32 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/darwin/package_manager.rb +24 -0
- data/lib/vagrant-bindfs/{cap/darwin/checks.rb → vagrant/capabilities/darwin/system_checks.rb} +7 -8
- data/lib/vagrant-bindfs/vagrant/capabilities/debian.rb +12 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/debian/bindfs.rb +39 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/debian/fuse.rb +16 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/debian/package_manager.rb +20 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/linux.rb +12 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/linux/fuse.rb +24 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/linux/package_manager.rb +16 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/linux/system_checks.rb +26 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/redhat.rb +12 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/redhat/bindfs.rb +39 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/redhat/fuse.rb +17 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/redhat/package_manager.rb +20 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/suse.rb +12 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/suse/bindfs.rb +41 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/suse/fuse.rb +17 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/suse/package_manager.rb +20 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/ubuntu.rb +10 -0
- data/lib/vagrant-bindfs/vagrant/capabilities/ubuntu/fuse.rb +23 -0
- data/lib/vagrant-bindfs/vagrant/config.rb +86 -0
- data/lib/vagrant-bindfs/vagrant/errors.rb +12 -0
- data/lib/vagrant-bindfs/vagrant/plugin.rb +43 -0
- data/lib/vagrant-bindfs/version.rb +3 -12
- data/locales/en.yml +71 -26
- metadata +48 -23
- data/lib/vagrant-bindfs/bind.rb +0 -109
- data/lib/vagrant-bindfs/cap/all/bindfs_installed.rb +0 -17
- data/lib/vagrant-bindfs/cap/all/checks.rb +0 -17
- data/lib/vagrant-bindfs/cap/darwin/fuse_loaded.rb +0 -19
- data/lib/vagrant-bindfs/cap/darwin/install_bindfs.rb +0 -61
- data/lib/vagrant-bindfs/cap/debian/install_bindfs.rb +0 -17
- data/lib/vagrant-bindfs/cap/fedora/install_bindfs.rb +0 -17
- data/lib/vagrant-bindfs/cap/linux/bindfs_installed.rb +0 -17
- data/lib/vagrant-bindfs/cap/linux/checks.rb +0 -21
- data/lib/vagrant-bindfs/cap/linux/enable_fuse.rb +0 -17
- data/lib/vagrant-bindfs/cap/linux/fuse_loaded.rb +0 -17
- data/lib/vagrant-bindfs/cap/redhat/install_bindfs.rb +0 -52
- data/lib/vagrant-bindfs/cap/suse/install_bindfs.rb +0 -17
- data/lib/vagrant-bindfs/cap/ubuntu/fuse_loaded.rb +0 -19
- data/lib/vagrant-bindfs/command.rb +0 -212
- data/lib/vagrant-bindfs/config.rb +0 -119
- data/lib/vagrant-bindfs/errors.rb +0 -7
- data/lib/vagrant-bindfs/plugin.rb +0 -145
- data/test/test_helper.rb +0 -20
@@ -1,52 +0,0 @@
|
|
1
|
-
require "vagrant-bindfs/version"
|
2
|
-
|
3
|
-
module VagrantPlugins
|
4
|
-
module Bindfs
|
5
|
-
module Cap
|
6
|
-
module RedHat
|
7
|
-
module InstallBindfs
|
8
|
-
class << self
|
9
|
-
|
10
|
-
def install_bindfs(machine)
|
11
|
-
machine.communicate.tap do |comm|
|
12
|
-
if comm.test("test 0 -eq $(sudo yum search bindfs 2>&1 >/dev/null | wc -l)")
|
13
|
-
comm.sudo("yum -y install bindfs")
|
14
|
-
else
|
15
|
-
comm.sudo("yum -y install fuse fuse-devel gcc wget tar make")
|
16
|
-
comm.sudo <<-SHELL
|
17
|
-
for u in "#{source_urls(machine).join('" "')}"; do
|
18
|
-
if wget -q --spider $u; then
|
19
|
-
url=$u;
|
20
|
-
break;
|
21
|
-
fi;
|
22
|
-
done;
|
23
|
-
[ -n "$url" ] && \
|
24
|
-
wget $url -O bindfs.tar.gz && \
|
25
|
-
tar --overwrite -zxvf bindfs.tar.gz && \
|
26
|
-
[ -d ./bindfs-#{source_version(machine)} ] && \
|
27
|
-
cd bindfs-#{source_version(machine)} && \
|
28
|
-
./configure && \
|
29
|
-
make && \
|
30
|
-
make install && \
|
31
|
-
ln -s /usr/local/bin/bindfs /usr/bin
|
32
|
-
SHELL
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
protected
|
38
|
-
|
39
|
-
def source_urls(machine)
|
40
|
-
SOURCE_URLS.map{ |url| url.gsub('%{source_version}', source_version(machine)) }
|
41
|
-
end
|
42
|
-
|
43
|
-
def source_version(machine)
|
44
|
-
machine.config.bindfs.source_version
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module Bindfs
|
3
|
-
module Cap
|
4
|
-
module Ubuntu
|
5
|
-
module FuseLoaded
|
6
|
-
class << self
|
7
|
-
|
8
|
-
def fuse_loaded(machine)
|
9
|
-
# Ubuntu 6.10 and after automatically load fuse.
|
10
|
-
# Just check if it is installed
|
11
|
-
machine.communicate.test("test -e /dev/fuse")
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,212 +0,0 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module Bindfs
|
3
|
-
class Command
|
4
|
-
|
5
|
-
attr_reader :source
|
6
|
-
attr_reader :destination
|
7
|
-
attr_reader :arguments
|
8
|
-
|
9
|
-
def initialize(env, options)
|
10
|
-
@env = env
|
11
|
-
@machine = env[:machine]
|
12
|
-
options = normalize_keys(options)
|
13
|
-
|
14
|
-
@source = options.delete("source-path")
|
15
|
-
@destination = options.delete("dest-path")
|
16
|
-
@arguments = arguments_for(default_options.merge(options))
|
17
|
-
end
|
18
|
-
|
19
|
-
def build
|
20
|
-
[ "bindfs", arguments.join(" "), source, destination ].compact.join(" ")
|
21
|
-
end
|
22
|
-
|
23
|
-
def user
|
24
|
-
@arguments.join(' ')[/--(?:force-)?user=([^\s]+)/, 1]
|
25
|
-
end
|
26
|
-
|
27
|
-
def group
|
28
|
-
@arguments.join(' ')[/--(?:force-)?group=([^\s]+)/, 1]
|
29
|
-
end
|
30
|
-
|
31
|
-
protected
|
32
|
-
|
33
|
-
def arguments_for(options)
|
34
|
-
available_options.reduce([]) do |args, (name, definition)|
|
35
|
-
|
36
|
-
short = definition[:short].detect{ |k| options.key?(k) }
|
37
|
-
long = definition[:long].detect{ |k| options.key?(k) }
|
38
|
-
value = case true
|
39
|
-
when !short.nil? then options[short]
|
40
|
-
when !long.nil? then options[long]
|
41
|
-
else definition[:default]
|
42
|
-
end
|
43
|
-
|
44
|
-
args << format_argument(name, definition, value) unless value.nil?
|
45
|
-
args
|
46
|
-
end.compact
|
47
|
-
end
|
48
|
-
|
49
|
-
def format_argument(name, definition, value)
|
50
|
-
if definition[:type] == :flag && !!value
|
51
|
-
return "-#{name}" if 0 == definition[:long].size # Shorthand only options
|
52
|
-
return "--#{name}"
|
53
|
-
end
|
54
|
-
if definition[:type] == :option
|
55
|
-
return "-#{name} #{value}" if 0 == definition[:long].size # Shorthand only options
|
56
|
-
return "--#{name}=#{value}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def normalize_keys(opts)
|
61
|
-
{}.tap do |hash|
|
62
|
-
opts.each do |key, value|
|
63
|
-
hash[key.to_s.gsub("_", "-")] = value
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def default_options
|
69
|
-
@default_options ||= normalize_keys(@machine.config.bindfs.default_options)
|
70
|
-
end
|
71
|
-
|
72
|
-
# TODO: Update after each bindfs release
|
73
|
-
def available_options
|
74
|
-
@available_options ||= begin
|
75
|
-
options = {
|
76
|
-
# File ownership
|
77
|
-
"force-user" => { long: ["force-user", "user", "owner"], short: ["u"], type: :option, default: "vagrant" },
|
78
|
-
"force-group" => { long: ["force-group", "group"], short: ["g"], type: :option, default: "vagrant" },
|
79
|
-
"perms" => { long: ["perms"], short: ["p"], type: :option, default: "u=rwX:g=rD:o=rD" },
|
80
|
-
"mirror" => { long: ["mirror"], short: ["m"], type: :option, default: nil },
|
81
|
-
"mirror-only" => { long: ["mirror-only"], short: ["M"], type: :option, default: nil },
|
82
|
-
"map" => { long: ["map"], short: [], type: :option, default: nil },
|
83
|
-
"uid-offset" => { long: ["uid-offset"], short: [], type: :option, default: nil },
|
84
|
-
"gid-offset" => { long: ["gid-offset"], short: [], type: :option, default: nil },
|
85
|
-
|
86
|
-
# File creation policy
|
87
|
-
"create-as-user" => { long: ["create-as-user"], short: [], type: :flag, default: false },
|
88
|
-
"create-as-mounter" => { long: ["create-as-mounter"], short: [], type: :flag, default: false },
|
89
|
-
"create-for-user" => { long: ["create-for-user"], short: [], type: :option, default: nil },
|
90
|
-
"create-for-group" => { long: ["create-for-group"], short: [], type: :option, default: nil },
|
91
|
-
"create-with-perms" => { long: ["create-with-perms"], short: [], type: :option, default: nil },
|
92
|
-
|
93
|
-
# Chown policy
|
94
|
-
"chown-normal" => { long: ["chown-normal"], short: [], type: :flag, default: false },
|
95
|
-
"chown-ignore" => { long: ["chown-ignore"], short: [], type: :flag, default: false },
|
96
|
-
"chown-deny" => { long: ["chown-deny"], short: [], type: :flag, default: false },
|
97
|
-
|
98
|
-
# Chgrp policy
|
99
|
-
"chgrp-normal" => { long: ["chgrp-normal"], short: [], type: :flag, default: false },
|
100
|
-
"chgrp-ignore" => { long: ["chgrp-ignore"], short: [], type: :flag, default: false },
|
101
|
-
"chgrp-deny" => { long: ["chgrp-deny"], short: [], type: :flag, default: false },
|
102
|
-
|
103
|
-
# Chmod policy
|
104
|
-
"chmod-normal" => { long: ["chmod-normal"], short: [], type: :flag, default: false },
|
105
|
-
"chmod-ignore" => { long: ["chmod-ignore"], short: [], type: :flag, default: false },
|
106
|
-
"chmod-deny" => { long: ["chmod-deny"], short: [], type: :flag, default: false },
|
107
|
-
"chmod-filter" => { long: ["chmod-filter"], short: [], type: :option, default: nil },
|
108
|
-
"chmod-allow-x" => { long: ["chmod-allow-x"], short: [], type: :flag, default: false },
|
109
|
-
|
110
|
-
# Extended attribute policy
|
111
|
-
"xattr-none" => { long: ["xattr-none"], short: [], type: :flag, default: false },
|
112
|
-
"xattr-ro" => { long: ["xattr-ro"], short: [], type: :flag, default: false },
|
113
|
-
"xattr-rw" => { long: ["xattr-rw"], short: [], type: :flag, default: false },
|
114
|
-
|
115
|
-
# Rate limits
|
116
|
-
"read-rate" => { long: ["read-rate"], short: [], type: :option, default: nil },
|
117
|
-
"write-rate" => { long: ["write-rate"], short: [], type: :option, default: nil },
|
118
|
-
|
119
|
-
# Link handling
|
120
|
-
"hide-hard-links" => { long: ["hide-hard-links"], short: [], type: :flag, default: false },
|
121
|
-
"resolve-symlinks" => { long: ["resolve-symlinks"], short: [], type: :flag, default: false },
|
122
|
-
"resolve-symlink-policy" => { long: ["resolve-symlink-policy"], short: [], type: :option, default: nil },
|
123
|
-
|
124
|
-
# Multithreading
|
125
|
-
"multithreaded" => { long: ["multithreaded"], short: [], type: :flag, default: false },
|
126
|
-
"enable-lock-forwarding" => { long: ["enable-lock-forwarding"], short: [], type: :flag, default: false },
|
127
|
-
"disable-lock-forwarding" => { long: ["disable-lock-forwarding"], short: [], type: :flag, default: false },
|
128
|
-
|
129
|
-
# Miscellaneous
|
130
|
-
"no-allow-other" => { long: ["no-allow-other"], short: ["n"], type: :flag, default: false },
|
131
|
-
"realistic-permissions" => { long: ["realistic-permissions"], short: [], type: :flag, default: false },
|
132
|
-
"ctime-from-mtime" => { long: ["ctime-from-mtime"], short: [], type: :flag, default: false },
|
133
|
-
"enabe-ioctl" => { long: ["enable-ioctl"], short: [], type: :flag, default: false },
|
134
|
-
|
135
|
-
# FUSE options
|
136
|
-
"o" => { long: [], short: ["o"], type: :option, default: nil },
|
137
|
-
"r" => { long: [], short: ["r"], type: :flag, default: false },
|
138
|
-
"d" => { long: [], short: ["d"], type: :flag, default: false },
|
139
|
-
"f" => { long: [], short: ["f"], type: :flag, default: false },
|
140
|
-
}
|
141
|
-
|
142
|
-
if bindfs_version_lower_than("1.13.2")
|
143
|
-
options.delete("uid-offset")
|
144
|
-
options.delete("gid-offset")
|
145
|
-
options.delete("enable-ioctl")
|
146
|
-
options.delete("enable-lock-forwarding")
|
147
|
-
options.delete("disable-lock-forwarding")
|
148
|
-
end
|
149
|
-
|
150
|
-
if bindfs_version_lower_than("1.13.0")
|
151
|
-
options.delete("resolve-symlinks")
|
152
|
-
options.delete("resolve-symlink-policy")
|
153
|
-
end
|
154
|
-
|
155
|
-
if bindfs_version_lower_than("1.12.6")
|
156
|
-
options.delete("read-rate")
|
157
|
-
options.delete("write-rate")
|
158
|
-
end
|
159
|
-
|
160
|
-
if bindfs_version_lower_than("1.12.2")
|
161
|
-
options.delete("chmod-filter")
|
162
|
-
end
|
163
|
-
|
164
|
-
if bindfs_version_lower_than("1.12")
|
165
|
-
options["user"] = options.delete("force-user")
|
166
|
-
options["group"] = options.delete("force-group")
|
167
|
-
end
|
168
|
-
|
169
|
-
if bindfs_version_lower_than("1.11")
|
170
|
-
options.delete("multithreaded")
|
171
|
-
end
|
172
|
-
|
173
|
-
if bindfs_version_lower_than("1.10")
|
174
|
-
options.delete("map")
|
175
|
-
options.delete("realistic-permissions")
|
176
|
-
options.delete("hide-hard-links")
|
177
|
-
end
|
178
|
-
|
179
|
-
# Can't track changes deeper as SVN repository was removed from https://code.google.com/p/bindfs/
|
180
|
-
|
181
|
-
options
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
def bindfs_version_lower_than(version)
|
186
|
-
bindfs_version < Gem::Version.new(version)
|
187
|
-
end
|
188
|
-
|
189
|
-
def bindfs_version
|
190
|
-
@bindfs_version ||= begin
|
191
|
-
version = catch(:version) do
|
192
|
-
[
|
193
|
-
%{sudo bindfs --version | cut -d" " -f2},
|
194
|
-
%{sudo -i bindfs --version | cut -d" " -f2}
|
195
|
-
].each do |command|
|
196
|
-
@machine.communicate.execute(command) do |type, output|
|
197
|
-
@env[:ui].info("#{command}: #{output.inspect}") if @machine.config.bindfs.debug
|
198
|
-
|
199
|
-
version = output.strip
|
200
|
-
throw(:version, Gem::Version.new(version)) if version.length > 0 && Gem::Version.correct?(version)
|
201
|
-
end
|
202
|
-
end
|
203
|
-
Gem::Version.new("0.0")
|
204
|
-
end
|
205
|
-
@env[:ui].info("Detected bindfs version: #{version}") if @machine.config.bindfs.debug
|
206
|
-
version
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
end
|
211
|
-
end
|
212
|
-
end
|
@@ -1,119 +0,0 @@
|
|
1
|
-
require "vagrant"
|
2
|
-
require "vagrant-bindfs/version"
|
3
|
-
|
4
|
-
module VagrantPlugins
|
5
|
-
module Bindfs
|
6
|
-
class Config < Vagrant.plugin("2", :config)
|
7
|
-
|
8
|
-
attr_accessor :debug
|
9
|
-
attr_accessor :source_version
|
10
|
-
|
11
|
-
attr_accessor :default_options
|
12
|
-
attr_accessor :bind_folders
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
@debug = UNSET_VALUE
|
16
|
-
@source_version = UNSET_VALUE
|
17
|
-
|
18
|
-
@default_options = UNSET_VALUE
|
19
|
-
@bind_folders = {}
|
20
|
-
end
|
21
|
-
|
22
|
-
def default_options(new_values = {})
|
23
|
-
@default_options = {} if @default_options == UNSET_VALUE
|
24
|
-
@default_options.merge! new_values
|
25
|
-
end
|
26
|
-
|
27
|
-
def bind_folder(source_path, dest_path, options = {})
|
28
|
-
options[:source_path] = source_path
|
29
|
-
options[:dest_path] = dest_path
|
30
|
-
options[:hook] ||= options.delete(:after) || VagrantPlugins::Bindfs::Plugin.hook_names.first
|
31
|
-
|
32
|
-
@bind_folders[options[:dest_path]] = options
|
33
|
-
end
|
34
|
-
|
35
|
-
def merge(other)
|
36
|
-
super.tap do |result|
|
37
|
-
result.default_options(default_options(other.default_options))
|
38
|
-
|
39
|
-
new_folders = bind_folders.dup
|
40
|
-
other_folders = other.bind_folders
|
41
|
-
|
42
|
-
other_folders.each do |id, options|
|
43
|
-
new_folders[id] ||= {}
|
44
|
-
new_folders[id].merge! options
|
45
|
-
end
|
46
|
-
|
47
|
-
result.bind_folders = new_folders
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def finalize!
|
52
|
-
if @debug == UNSET_VALUE
|
53
|
-
@debug = false
|
54
|
-
end
|
55
|
-
|
56
|
-
if @source_version == UNSET_VALUE
|
57
|
-
@source_version = VagrantPlugins::Bindfs::SOURCE_VERSION
|
58
|
-
end
|
59
|
-
|
60
|
-
if @default_options == UNSET_VALUE
|
61
|
-
@default_options = {}
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def validate!(machine)
|
66
|
-
finalize!
|
67
|
-
errors = []
|
68
|
-
|
69
|
-
bind_folders.each do |id, options|
|
70
|
-
next if options[:disabled]
|
71
|
-
|
72
|
-
unless VagrantPlugins::Bindfs::Plugin.hook_names.include?(options[:hook].to_sym)
|
73
|
-
errors << I18n.t(
|
74
|
-
"vagrant.config.bindfs.errors.invalid_hook",
|
75
|
-
hooks: VagrantPlugins::Bindfs::Plugin.hook_names
|
76
|
-
)
|
77
|
-
end
|
78
|
-
|
79
|
-
if options[:dest_path].nil? or options[:source_path].nil?
|
80
|
-
errors << I18n.t(
|
81
|
-
"vagrant.config.bindfs.errors.no_path_supplied",
|
82
|
-
path: options[:dest_path]
|
83
|
-
)
|
84
|
-
end
|
85
|
-
|
86
|
-
if Pathname.new(options[:dest_path]).relative?
|
87
|
-
errors << I18n.t(
|
88
|
-
"vagrant.config.bindfs.errors.destination_path_relative",
|
89
|
-
path: options[:dest_path]
|
90
|
-
)
|
91
|
-
end
|
92
|
-
|
93
|
-
if Pathname.new(options[:source_path]).relative?
|
94
|
-
errors << I18n.t(
|
95
|
-
"vagrant.config.bindfs.errors.source_path_relative",
|
96
|
-
path: options[:source_path]
|
97
|
-
)
|
98
|
-
end
|
99
|
-
|
100
|
-
unless Pathname.new(options[:dest_path]).to_path.match(/^\/vagrant/).nil?
|
101
|
-
errors << I18n.t(
|
102
|
-
"vagrant.config.bindfs.errors.destination_path_reserved",
|
103
|
-
path: options[:dest_path]
|
104
|
-
)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
if errors.any?
|
109
|
-
rendered_errors = Vagrant::Util::TemplateRenderer.render(
|
110
|
-
'config/validation_failed',
|
111
|
-
errors: { 'vagrant-bindfs' => errors }
|
112
|
-
)
|
113
|
-
|
114
|
-
fail Vagrant::Errors::ConfigInvalid, errors: rendered_errors
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
@@ -1,145 +0,0 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module Bindfs
|
3
|
-
class Plugin < Vagrant.plugin("2")
|
4
|
-
|
5
|
-
name "Bindfs"
|
6
|
-
description <<-DESC
|
7
|
-
This plugin allows you to mount -o bind filesystems inside the guest. This is
|
8
|
-
useful to change their ownership and permissions.
|
9
|
-
DESC
|
10
|
-
|
11
|
-
|
12
|
-
config(:bindfs) do
|
13
|
-
require "vagrant-bindfs/config"
|
14
|
-
Config
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
guest_capability("linux", "bindfs_check_user") do
|
19
|
-
require "vagrant-bindfs/cap/linux/checks"
|
20
|
-
Cap::Linux::Checks
|
21
|
-
end
|
22
|
-
|
23
|
-
guest_capability("darwin", "bindfs_check_user") do
|
24
|
-
require "vagrant-bindfs/cap/darwin/checks"
|
25
|
-
Cap::Darwin::Checks
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
guest_capability("linux", "bindfs_check_group") do
|
30
|
-
require "vagrant-bindfs/cap/linux/checks"
|
31
|
-
Cap::Linux::Checks
|
32
|
-
end
|
33
|
-
|
34
|
-
guest_capability("darwin", "bindfs_check_group") do
|
35
|
-
require "vagrant-bindfs/cap/darwin/checks"
|
36
|
-
Cap::Darwin::Checks
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
guest_capability("linux", "bindfs_check_mount") do
|
41
|
-
require "vagrant-bindfs/cap/all/checks"
|
42
|
-
Cap::All::Checks
|
43
|
-
end
|
44
|
-
|
45
|
-
guest_capability("darwin", "bindfs_check_mount") do
|
46
|
-
require "vagrant-bindfs/cap/all/checks"
|
47
|
-
Cap::All::Checks
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
guest_capability("linux", "bindfs_installed") do
|
52
|
-
require "vagrant-bindfs/cap/all/bindfs_installed"
|
53
|
-
Cap::All::BindfsInstalled
|
54
|
-
end
|
55
|
-
|
56
|
-
guest_capability("darwin", "bindfs_installed") do
|
57
|
-
require "vagrant-bindfs/cap/all/bindfs_installed"
|
58
|
-
Cap::All::BindfsInstalled
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
guest_capability("linux", "fuse_loaded") do
|
63
|
-
require "vagrant-bindfs/cap/linux/fuse_loaded"
|
64
|
-
Cap::Linux::FuseLoaded
|
65
|
-
end
|
66
|
-
|
67
|
-
guest_capability("ubuntu", "fuse_loaded") do
|
68
|
-
require "vagrant-bindfs/cap/ubuntu/fuse_loaded"
|
69
|
-
Cap::Ubuntu::FuseLoaded
|
70
|
-
end
|
71
|
-
|
72
|
-
guest_capability("darwin", "fuse_loaded") do
|
73
|
-
require "vagrant-bindfs/cap/darwin/fuse_loaded"
|
74
|
-
Cap::Darwin::FuseLoaded
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
guest_capability("linux", "enable_fuse") do
|
79
|
-
require "vagrant-bindfs/cap/linux/enable_fuse"
|
80
|
-
Cap::Linux::EnableFuse
|
81
|
-
end
|
82
|
-
|
83
|
-
|
84
|
-
guest_capability("debian", "install_bindfs") do
|
85
|
-
require "vagrant-bindfs/cap/debian/install_bindfs"
|
86
|
-
Cap::Debian::InstallBindfs
|
87
|
-
end
|
88
|
-
|
89
|
-
guest_capability("redhat", "install_bindfs") do
|
90
|
-
require 'vagrant-bindfs/cap/redhat/install_bindfs'
|
91
|
-
Cap::RedHat::InstallBindfs
|
92
|
-
end
|
93
|
-
|
94
|
-
guest_capability("fedora", "install_bindfs") do
|
95
|
-
require 'vagrant-bindfs/cap/fedora/install_bindfs'
|
96
|
-
Cap::Fedora::InstallBindfs
|
97
|
-
end
|
98
|
-
|
99
|
-
guest_capability("suse", "install_bindfs") do
|
100
|
-
require "vagrant-bindfs/cap/suse/install_bindfs"
|
101
|
-
Cap::Suse::InstallBindfs
|
102
|
-
end
|
103
|
-
|
104
|
-
guest_capability("darwin", "install_bindfs") do
|
105
|
-
require "vagrant-bindfs/cap/darwin/install_bindfs"
|
106
|
-
Cap::Darwin::InstallBindfs
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
require "vagrant-bindfs/bind"
|
111
|
-
|
112
|
-
%w{up reload}.each do |action|
|
113
|
-
action_hook(:bindfs, "machine_action_#{action}".to_sym) do |hook|
|
114
|
-
hooks.each do |(name, action)|
|
115
|
-
hook.before(action, Action::Bind, name)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
class << self
|
121
|
-
|
122
|
-
def hooks
|
123
|
-
@hooks ||= begin
|
124
|
-
synced_folders = if Vagrant::Action::Builtin.const_defined? :NFS
|
125
|
-
Vagrant::Action::Builtin::NFS
|
126
|
-
else
|
127
|
-
Vagrant::Action::Builtin::SyncedFolders
|
128
|
-
end
|
129
|
-
|
130
|
-
{
|
131
|
-
:synced_folders => synced_folders,
|
132
|
-
:provision => Vagrant::Action::Builtin::Provision
|
133
|
-
}
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def hook_names
|
138
|
-
hooks.keys
|
139
|
-
end
|
140
|
-
|
141
|
-
end
|
142
|
-
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|