vagrant-bindfs 0.3.0 → 0.3.1
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/README.md +48 -82
 - data/lib/vagrant-bindfs/bind.rb +12 -155
 - data/lib/vagrant-bindfs/command.rb +161 -0
 - data/lib/vagrant-bindfs/config.rb +3 -2
 - data/lib/vagrant-bindfs/version.rb +1 -1
 - metadata +9 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1019eb9a428aedf0d85c9d6298008cfae8b22b7d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 114ec7c1d5200eb16beeac32f06df2e23a976bb4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f840aae90268594fe341b7e05e320234bd178aae9c7102e6c23d1efde6413040afc075060038ec07d5e7c3c9eb6282e02cd0ab7f72e63dc23f904965da4c2a07
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 59daf2c4aa63b1e91b5dbb57ad6adcc3e66423dac1631f68e353e28ee5dbde7566fe52865e350fd379f5e510873585047037d341a2fdf51560ffcfcf18855f8a
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -28,14 +28,14 @@ _Note that `map_uid` and `map_gid` NFS options can be used to set the identity u 
     | 
|
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            ## Installation
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
            Vagrant-bindfs is distributed as a Ruby gem. 
     | 
| 
       32 
     | 
    
         
            -
            with `vagrant plugin install vagrant-bindfs`.
         
     | 
| 
      
 31 
     | 
    
         
            +
            Vagrant-bindfs is distributed as a Ruby gem.
         
     | 
| 
      
 32 
     | 
    
         
            +
            You can install it as any other Vagrant plugin with `vagrant plugin install vagrant-bindfs`.
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
            ## Usage
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
            In your `Vagrantfile`, use `config.bindfs.bind_folder` to configure folders that will be binded on VM
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 37 
     | 
    
         
            +
            In your `Vagrantfile`, use `config.bindfs.bind_folder` to configure folders that will be binded on VM startup.
         
     | 
| 
      
 38 
     | 
    
         
            +
            The format is:
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
            ```ruby
         
     | 
| 
       41 
41 
     | 
    
         
             
            config.bindfs.bind_folder "/path/to/source", "/path/to/destination", options
         
     | 
| 
         @@ -45,25 +45,35 @@ config.bindfs.bind_folder "/path/to/source", "/path/to/destination", options 
     | 
|
| 
       45 
45 
     | 
    
         
             
            ### Example
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
            ```ruby
         
     | 
| 
       48 
     | 
    
         
            -
            Vagrant 
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
            Vagrant.configure("2") do |config|
         
     | 
| 
      
 49 
     | 
    
         
            +
              
         
     | 
| 
       50 
50 
     | 
    
         
             
              [...] # Your VM configuration
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
              
         
     | 
| 
       52 
52 
     | 
    
         
             
              ## Basic usage
         
     | 
| 
       53 
53 
     | 
    
         
             
              config.bindfs.bind_folder "source/dir", "mount/point"
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 54 
     | 
    
         
            +
              
         
     | 
| 
      
 55 
     | 
    
         
            +
              
         
     | 
| 
       55 
56 
     | 
    
         
             
              ## Advanced options
         
     | 
| 
       56 
57 
     | 
    
         
             
              config.bindfs.bind_folder "source/dir", "mount/point",
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
                perms: "u=rw:g=r:o=r",
         
     | 
| 
      
 59 
     | 
    
         
            +
                create_as_user: true
         
     | 
| 
      
 60 
     | 
    
         
            +
              
         
     | 
| 
      
 61 
     | 
    
         
            +
              
         
     | 
| 
       60 
62 
     | 
    
         
             
              ## Complete example for a NFS shared folder
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
      
 63 
     | 
    
         
            +
              
         
     | 
| 
      
 64 
     | 
    
         
            +
              # Static IP is required to use NFS shared folder
         
     | 
| 
      
 65 
     | 
    
         
            +
              config.vm.network "private_network", ip: "192.168.50.4"
         
     | 
| 
      
 66 
     | 
    
         
            +
              
         
     | 
| 
       62 
67 
     | 
    
         
             
              # Declare shared folder with Vagrant syntax
         
     | 
| 
       63 
     | 
    
         
            -
              config.vm.synced_folder " 
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
      
 68 
     | 
    
         
            +
              config.vm.synced_folder "host/source/dir", "/vagrant-nfs", :type => :nfs
         
     | 
| 
      
 69 
     | 
    
         
            +
              
         
     | 
| 
       65 
70 
     | 
    
         
             
              # Use vagrant-bindfs to re-mount folder
         
     | 
| 
       66 
     | 
    
         
            -
              config.bindfs.bind_folder "/vagrant-nfs", "/ 
     | 
| 
      
 71 
     | 
    
         
            +
              config.bindfs.bind_folder "/vagrant-nfs", "guest/mount/point"
         
     | 
| 
      
 72 
     | 
    
         
            +
              
         
     | 
| 
      
 73 
     | 
    
         
            +
              
         
     | 
| 
      
 74 
     | 
    
         
            +
              ## Share the default `vagrant` folder via NFS with your own options
         
     | 
| 
      
 75 
     | 
    
         
            +
              config.vm.synced_folder ".", "/vagrant", type: :nfs
         
     | 
| 
      
 76 
     | 
    
         
            +
              config.bindfs.bind_folder "/vagrant", "/vagrant"
         
     | 
| 
       67 
77 
     | 
    
         | 
| 
       68 
78 
     | 
    
         
             
            end
         
     | 
| 
       69 
79 
     | 
    
         
             
            ```
         
     | 
| 
         @@ -71,83 +81,39 @@ end 
     | 
|
| 
       71 
81 
     | 
    
         | 
| 
       72 
82 
     | 
    
         
             
            ### Supported options
         
     | 
| 
       73 
83 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
            The `bind_folder` config  
     | 
| 
       75 
     | 
    
         
            -
            with  
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
            -  
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
            -  
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
            -  
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
            There are also options available for backward compatibility, if one of these options is defined
         
     | 
| 
       91 
     | 
    
         
            -
            the newer counterpart will be unset:
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
            - `:owner`
         
     | 
| 
       94 
     | 
    
         
            -
            - `:group`
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
            The following shortcuts are also available:
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
            - `:o`
         
     | 
| 
       99 
     | 
    
         
            -
            - `:u` (Overwrites the value of force_user)
         
     | 
| 
       100 
     | 
    
         
            -
            - `:g` (Overwrites the value of force_group)
         
     | 
| 
       101 
     | 
    
         
            -
            - `:m` (Overwrites the value of mirror)
         
     | 
| 
       102 
     | 
    
         
            -
            - `:M` (Overwrites the value of mirror_only)
         
     | 
| 
       103 
     | 
    
         
            -
            - `:p` (Overwrites the value of perms)
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
            … and the following flags (all disabled by default, vagrant-bindfs rely on bindfs own defaults):
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
            - `:create_as_user`
         
     | 
| 
       108 
     | 
    
         
            -
            - `:create_as_mounter`
         
     | 
| 
       109 
     | 
    
         
            -
            - `:chown_normal`
         
     | 
| 
       110 
     | 
    
         
            -
            - `:chown_ignore`
         
     | 
| 
       111 
     | 
    
         
            -
            - `:chown_deny`
         
     | 
| 
       112 
     | 
    
         
            -
            - `:chgrp_normal`
         
     | 
| 
       113 
     | 
    
         
            -
            - `:chgrp_ignore`
         
     | 
| 
       114 
     | 
    
         
            -
            - `:chgrp_deny`
         
     | 
| 
       115 
     | 
    
         
            -
            - `:chmod_normal`
         
     | 
| 
       116 
     | 
    
         
            -
            - `:chmod_ignore`
         
     | 
| 
       117 
     | 
    
         
            -
            - `:chmod_deny`
         
     | 
| 
       118 
     | 
    
         
            -
            - `:chmod_allow_x`
         
     | 
| 
       119 
     | 
    
         
            -
            - `:xattr_none`
         
     | 
| 
       120 
     | 
    
         
            -
            - `:xattr_ro`
         
     | 
| 
       121 
     | 
    
         
            -
            - `:xattr_rw`
         
     | 
| 
       122 
     | 
    
         
            -
            - `:no_allow_other`
         
     | 
| 
       123 
     | 
    
         
            -
            - `:realistic_permissions`
         
     | 
| 
       124 
     | 
    
         
            -
            - `:ctime_from_mtime`
         
     | 
| 
       125 
     | 
    
         
            -
            - `:hide_hard_links`
         
     | 
| 
       126 
     | 
    
         
            -
            - `:multithreaded`
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
            You can overwrite default options _via_ `config.bindfs.default_options`. See
         
     | 
| 
       129 
     | 
    
         
            -
            [bindfs man page](http://bindfs.org/docs/bindfs.1.html) for details.
         
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
            vagrant-bindfs does not check compatibility between given arguments but warn you when a binding
         
     | 
| 
       132 
     | 
    
         
            -
            command fail or if bindfs is not installed on your virtual machine. On Debian and SUSE systems, it
         
     | 
| 
       133 
     | 
    
         
            -
            will try to install bindfs automatically.
         
     | 
| 
      
 84 
     | 
    
         
            +
            The `bind_folder` config accept any option you can pass to bindfs.
         
     | 
| 
      
 85 
     | 
    
         
            +
            vagrant-bindfs is compatible with bindfs from version 1.9 to 1.12.6.
         
     | 
| 
      
 86 
     | 
    
         
            +
            Check [lib/vagrant-bindfs/command.rb](https://github.com/gael-ian/vagrant-bindfs/blob/master/lib/vagrant-bindfs/command.rb#L66) for a complete list of supported options and default values.
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            Both long arguments and shorthand are supported.
         
     | 
| 
      
 89 
     | 
    
         
            +
            If you set both, shorthand will prevail.
         
     | 
| 
      
 90 
     | 
    
         
            +
            Long arguments can be written indifferently with underscore ('force_user') or dash ('force-user') and as strings (:'force-user') or symbols (:force_user).
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
            You can overwrite default options _via_ `config.bindfs.default_options`.
         
     | 
| 
      
 93 
     | 
    
         
            +
            See [bindfs man page](http://bindfs.org/docs/bindfs.1.html) for details.
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            vagrant-bindfs detects installed version of bindfs, translate option names when needed and ignore an option if it is not supported.
         
     | 
| 
      
 96 
     | 
    
         
            +
            As we may have missed something, it will warn you when a binding command fail.
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
            On Debian and SUSE guest systems, vagrant-bindfs will try to install bindfs automatically if it is not installed.
         
     | 
| 
      
 99 
     | 
    
         
            +
            On other system, you'll get warned.
         
     | 
| 
       134 
100 
     | 
    
         | 
| 
       135 
101 
     | 
    
         | 
| 
       136 
102 
     | 
    
         
             
            ## Contributing
         
     | 
| 
       137 
103 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
            If you find this plugin useful, we could use a few enhancements! 
     | 
| 
       139 
     | 
    
         
            -
            for installing vagrant-bindfs on systems other than Debian or SUSE would be useful. 
     | 
| 
       140 
     | 
    
         
            -
            use some specs…
         
     | 
| 
      
 104 
     | 
    
         
            +
            If you find this plugin useful, we could use a few enhancements!
         
     | 
| 
      
 105 
     | 
    
         
            +
            In particular, capabilities files for installing vagrant-bindfs on systems other than Debian or SUSE would be useful.
         
     | 
| 
      
 106 
     | 
    
         
            +
            We could also use some specs…
         
     | 
| 
       141 
107 
     | 
    
         | 
| 
       142 
108 
     | 
    
         | 
| 
       143 
109 
     | 
    
         
             
            ### How to Test Changes
         
     | 
| 
       144 
110 
     | 
    
         | 
| 
       145 
     | 
    
         
            -
            If you've made changes to this plugin, you can easily test it locally in vagrant. 
     | 
| 
       146 
     | 
    
         
            -
            the repo, do:
         
     | 
| 
      
 111 
     | 
    
         
            +
            If you've made changes to this plugin, you can easily test it locally in vagrant.
         
     | 
| 
      
 112 
     | 
    
         
            +
            From the root of the repo, do:
         
     | 
| 
       147 
113 
     | 
    
         | 
| 
       148 
114 
     | 
    
         
             
            - `bundle install`
         
     | 
| 
       149 
115 
     | 
    
         
             
            - `rake build`
         
     | 
| 
       150 
116 
     | 
    
         
             
            - `bundle exec vagrant up`
         
     | 
| 
       151 
117 
     | 
    
         | 
| 
       152 
     | 
    
         
            -
            This will spin up a default Debian VM and try to bindfs-mount some shares in it. 
     | 
| 
       153 
     | 
    
         
            -
            the included `Vagrantfile` to add additional test cases.
         
     | 
| 
      
 118 
     | 
    
         
            +
            This will spin up a default Debian VM and try to bindfs-mount some shares in it.
         
     | 
| 
      
 119 
     | 
    
         
            +
            Feel free to modify the included `Vagrantfile` to add additional test cases.
         
     | 
    
        data/lib/vagrant-bindfs/bind.rb
    CHANGED
    
    | 
         @@ -1,3 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "vagrant-bindfs/command"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            module VagrantPlugins
         
     | 
| 
       2 
4 
     | 
    
         
             
              module Bindfs
         
     | 
| 
       3 
5 
     | 
    
         
             
                module Action
         
     | 
| 
         @@ -23,118 +25,39 @@ module VagrantPlugins 
     | 
|
| 
       23 
25 
     | 
    
         
             
                      @machine.config.bindfs.bind_folders
         
     | 
| 
       24 
26 
     | 
    
         
             
                    end
         
     | 
| 
       25 
27 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
                    def default_options
         
     | 
| 
       27 
     | 
    
         
            -
                      current_defaults = @machine.config.bindfs.default_options
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                      new_defaults = {}.tap do |new_default|
         
     | 
| 
       30 
     | 
    
         
            -
                        current_defaults.each do |key, value|
         
     | 
| 
       31 
     | 
    
         
            -
                          new_default[key.to_s.gsub("_", "-")] = value
         
     | 
| 
       32 
     | 
    
         
            -
                        end
         
     | 
| 
       33 
     | 
    
         
            -
                      end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                      available_options.merge(
         
     | 
| 
       36 
     | 
    
         
            -
                        available_shortcuts
         
     | 
| 
       37 
     | 
    
         
            -
                      ).merge(
         
     | 
| 
       38 
     | 
    
         
            -
                        available_flags
         
     | 
| 
       39 
     | 
    
         
            -
                      ).merge(
         
     | 
| 
       40 
     | 
    
         
            -
                        new_defaults
         
     | 
| 
       41 
     | 
    
         
            -
                      )
         
     | 
| 
       42 
     | 
    
         
            -
                    end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                    def normalize_options(current_options)
         
     | 
| 
       45 
     | 
    
         
            -
                      new_options = {}.tap do |new_option|
         
     | 
| 
       46 
     | 
    
         
            -
                        current_options.each do |key, value|
         
     | 
| 
       47 
     | 
    
         
            -
                          new_option[key.to_s.gsub("_", "-")] = value
         
     | 
| 
       48 
     | 
    
         
            -
                        end
         
     | 
| 
       49 
     | 
    
         
            -
                      end
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                      source = new_options.delete("source-path")
         
     | 
| 
       52 
     | 
    
         
            -
                      dest = new_options.delete("dest-path")
         
     | 
| 
       53 
     | 
    
         
            -
                      options = default_options.merge(new_options)
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                      args = [].tap do |arg|
         
     | 
| 
       56 
     | 
    
         
            -
                        options.each do |key, value|
         
     | 
| 
       57 
     | 
    
         
            -
                          next if key == "force-user" and options.keys.include? "owner"
         
     | 
| 
       58 
     | 
    
         
            -
                          next if key == "force-user" and options.keys.include? "u"
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                          next if key == "force-group" and options.keys.include? "group"
         
     | 
| 
       61 
     | 
    
         
            -
                          next if key == "force-group" and options.keys.include? "g"
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                          next if key == "mirror" and options.keys.include? "m"
         
     | 
| 
       64 
     | 
    
         
            -
                          next if key == "mirror-only" and options.keys.include? "M"
         
     | 
| 
       65 
     | 
    
         
            -
                          next if key == "perms" and options.keys.include? "p"
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                          if available_flags.keys.include? key
         
     | 
| 
       68 
     | 
    
         
            -
                            arg.push "--#{key}" if value
         
     | 
| 
       69 
     | 
    
         
            -
                            next
         
     | 
| 
       70 
     | 
    
         
            -
                          end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                          next if value.nil?
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                          if available_shortcuts.keys.include?(key) or additional_shortcuts.keys.include?(key)
         
     | 
| 
       75 
     | 
    
         
            -
                            arg.push "-#{key} '#{value}'"
         
     | 
| 
       76 
     | 
    
         
            -
                            next
         
     | 
| 
       77 
     | 
    
         
            -
                          end
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
                          if available_options.keys.include?(key) or additional_options.keys.include?(key)
         
     | 
| 
       80 
     | 
    
         
            -
                            arg.push "--#{key}='#{value}'"
         
     | 
| 
       81 
     | 
    
         
            -
                            next
         
     | 
| 
       82 
     | 
    
         
            -
                          end
         
     | 
| 
       83 
     | 
    
         
            -
                        end
         
     | 
| 
       84 
     | 
    
         
            -
                      end
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                      [
         
     | 
| 
       87 
     | 
    
         
            -
                        source,
         
     | 
| 
       88 
     | 
    
         
            -
                        dest,
         
     | 
| 
       89 
     | 
    
         
            -
                        args.join(" ")
         
     | 
| 
       90 
     | 
    
         
            -
                      ]
         
     | 
| 
       91 
     | 
    
         
            -
                    end
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
28 
     | 
    
         
             
                    def bind_folders
         
     | 
| 
       94 
29 
     | 
    
         
             
                      @env[:ui].info I18n.t("vagrant.config.bindfs.status.binding_all")
         
     | 
| 
       95 
30 
     | 
    
         | 
| 
       96 
31 
     | 
    
         
             
                      binded_folders.each do |id, options|
         
     | 
| 
       97 
     | 
    
         
            -
                        source, dest, args = normalize_options(options)
         
     | 
| 
       98 
32 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
                         
     | 
| 
       100 
     | 
    
         
            -
                          "bindfs",
         
     | 
| 
       101 
     | 
    
         
            -
                          args,
         
     | 
| 
       102 
     | 
    
         
            -
                          source,
         
     | 
| 
       103 
     | 
    
         
            -
                          dest
         
     | 
| 
       104 
     | 
    
         
            -
                        ].compact
         
     | 
| 
      
 33 
     | 
    
         
            +
                        command = VagrantPlugins::Bindfs::Command.new(@machine, options)
         
     | 
| 
       105 
34 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
                        unless @machine.communicate.test("test -d #{source}")
         
     | 
| 
      
 35 
     | 
    
         
            +
                        unless @machine.communicate.test("test -d #{command.source}")
         
     | 
| 
       107 
36 
     | 
    
         
             
                          @env[:ui].error I18n.t(
         
     | 
| 
       108 
37 
     | 
    
         
             
                            "vagrant.config.bindfs.errors.source_path_not_exist",
         
     | 
| 
       109 
     | 
    
         
            -
                            path: source
         
     | 
| 
      
 38 
     | 
    
         
            +
                            path: command.source
         
     | 
| 
       110 
39 
     | 
    
         
             
                          )
         
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
40 
     | 
    
         
             
                          next
         
     | 
| 
       113 
41 
     | 
    
         
             
                        end
         
     | 
| 
       114 
42 
     | 
    
         | 
| 
       115 
     | 
    
         
            -
                        if @machine.communicate.test("mount | grep bindfs | grep #{ 
     | 
| 
      
 43 
     | 
    
         
            +
                        if @machine.communicate.test("mount | grep bindfs | grep #{command.destination}")
         
     | 
| 
       116 
44 
     | 
    
         
             
                          @env[:ui].info I18n.t(
         
     | 
| 
       117 
45 
     | 
    
         
             
                            "vagrant.config.bindfs.already_mounted",
         
     | 
| 
       118 
     | 
    
         
            -
                            dest:  
     | 
| 
      
 46 
     | 
    
         
            +
                            dest: command.destination
         
     | 
| 
       119 
47 
     | 
    
         
             
                          )
         
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
48 
     | 
    
         
             
                          next
         
     | 
| 
       122 
49 
     | 
    
         
             
                        end
         
     | 
| 
       123 
50 
     | 
    
         | 
| 
       124 
51 
     | 
    
         
             
                        @env[:ui].info I18n.t(
         
     | 
| 
       125 
52 
     | 
    
         
             
                          "vagrant.config.bindfs.status.binding_entry",
         
     | 
| 
       126 
     | 
    
         
            -
                          dest:  
     | 
| 
       127 
     | 
    
         
            -
                          source: source
         
     | 
| 
      
 53 
     | 
    
         
            +
                          dest: command.destination,
         
     | 
| 
      
 54 
     | 
    
         
            +
                          source: command.source
         
     | 
| 
       128 
55 
     | 
    
         
             
                        )
         
     | 
| 
       129 
56 
     | 
    
         | 
| 
       130 
57 
     | 
    
         
             
                        @machine.communicate.tap do |comm|
         
     | 
| 
       131 
     | 
    
         
            -
                          comm.sudo("mkdir -p #{ 
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
                           
     | 
| 
       134 
     | 
    
         
            -
                            bind_command.join(" "),
         
     | 
| 
       135 
     | 
    
         
            -
                            error_class: Error,
         
     | 
| 
       136 
     | 
    
         
            -
                            error_key: :binding_failed
         
     | 
| 
       137 
     | 
    
         
            -
                          )
         
     | 
| 
      
 58 
     | 
    
         
            +
                          comm.sudo("mkdir -p #{command.destination}")
         
     | 
| 
      
 59 
     | 
    
         
            +
                          comm.sudo(command.build, error_class: Error, error_key: :binding_failed)
         
     | 
| 
      
 60 
     | 
    
         
            +
                          @env[:ui].info(command.build) if @machine.config.bindfs.debug
         
     | 
| 
       138 
61 
     | 
    
         
             
                        end
         
     | 
| 
       139 
62 
     | 
    
         
             
                      end
         
     | 
| 
       140 
63 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -149,72 +72,6 @@ module VagrantPlugins 
     | 
|
| 
       149 
72 
     | 
    
         
             
                      end
         
     | 
| 
       150 
73 
     | 
    
         
             
                    end
         
     | 
| 
       151 
74 
     | 
    
         | 
| 
       152 
     | 
    
         
            -
                    def available_options
         
     | 
| 
       153 
     | 
    
         
            -
                      @available_options ||= {
         
     | 
| 
       154 
     | 
    
         
            -
                        "force-user" => "vagrant",
         
     | 
| 
       155 
     | 
    
         
            -
                        "force-group" => "vagrant",
         
     | 
| 
       156 
     | 
    
         
            -
                        "perms" => "u=rwX:g=rD:o=rD",
         
     | 
| 
       157 
     | 
    
         
            -
                        "mirror" => nil,
         
     | 
| 
       158 
     | 
    
         
            -
                        "mirror-only" => nil,
         
     | 
| 
       159 
     | 
    
         
            -
                        "map" => nil,
         
     | 
| 
       160 
     | 
    
         
            -
                        "create-for-user" => nil,
         
     | 
| 
       161 
     | 
    
         
            -
                        "create-for-group" => nil,
         
     | 
| 
       162 
     | 
    
         
            -
                        "create-with-perms" => nil,
         
     | 
| 
       163 
     | 
    
         
            -
                        "chmod-filter" => nil,
         
     | 
| 
       164 
     | 
    
         
            -
                        "read-rate" => nil,
         
     | 
| 
       165 
     | 
    
         
            -
                        "write-rate" => nil
         
     | 
| 
       166 
     | 
    
         
            -
                      }.freeze
         
     | 
| 
       167 
     | 
    
         
            -
                    end
         
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
       169 
     | 
    
         
            -
                    def additional_options
         
     | 
| 
       170 
     | 
    
         
            -
                      @additional_options ||= {
         
     | 
| 
       171 
     | 
    
         
            -
                        # only for old versions, this will result in an error
         
     | 
| 
       172 
     | 
    
         
            -
                        # if you try that within current bindfs versions!
         
     | 
| 
       173 
     | 
    
         
            -
                        "owner" => "vagrant",
         
     | 
| 
       174 
     | 
    
         
            -
                        "group" => "vagrant"
         
     | 
| 
       175 
     | 
    
         
            -
                      }.freeze
         
     | 
| 
       176 
     | 
    
         
            -
                    end
         
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
                    def available_shortcuts
         
     | 
| 
       179 
     | 
    
         
            -
                      @available_shortcuts ||= {
         
     | 
| 
       180 
     | 
    
         
            -
                        "o" => nil
         
     | 
| 
       181 
     | 
    
         
            -
                      }.freeze
         
     | 
| 
       182 
     | 
    
         
            -
                    end
         
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
                    def additional_shortcuts
         
     | 
| 
       185 
     | 
    
         
            -
                      @additional_shortcuts ||= {
         
     | 
| 
       186 
     | 
    
         
            -
                        "u" => nil, # overwrites the value of force-user
         
     | 
| 
       187 
     | 
    
         
            -
                        "g" => nil, # overwrites the value of force-group
         
     | 
| 
       188 
     | 
    
         
            -
                        "m" => nil, # overwrites the value of mirror
         
     | 
| 
       189 
     | 
    
         
            -
                        "M" => nil, # overwrites the value of mirror-only
         
     | 
| 
       190 
     | 
    
         
            -
                        "p" => nil  # overwrites the value of perms
         
     | 
| 
       191 
     | 
    
         
            -
                      }.freeze
         
     | 
| 
       192 
     | 
    
         
            -
                    end
         
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
                    def available_flags
         
     | 
| 
       195 
     | 
    
         
            -
                      @available_flags ||= {
         
     | 
| 
       196 
     | 
    
         
            -
                        "create-as-user" => false,
         
     | 
| 
       197 
     | 
    
         
            -
                        "create-as-mounter" => false,
         
     | 
| 
       198 
     | 
    
         
            -
                        "chown-normal" => false,
         
     | 
| 
       199 
     | 
    
         
            -
                        "chown-ignore" => false,
         
     | 
| 
       200 
     | 
    
         
            -
                        "chown-deny" => false,
         
     | 
| 
       201 
     | 
    
         
            -
                        "chgrp-normal" => false,
         
     | 
| 
       202 
     | 
    
         
            -
                        "chgrp-ignore" => false,
         
     | 
| 
       203 
     | 
    
         
            -
                        "chgrp-deny" => false,
         
     | 
| 
       204 
     | 
    
         
            -
                        "chmod-normal" => false,
         
     | 
| 
       205 
     | 
    
         
            -
                        "chmod-ignore" => false,
         
     | 
| 
       206 
     | 
    
         
            -
                        "chmod-deny" => false,
         
     | 
| 
       207 
     | 
    
         
            -
                        "chmod-allow-x" => false,
         
     | 
| 
       208 
     | 
    
         
            -
                        "xattr-none" => false,
         
     | 
| 
       209 
     | 
    
         
            -
                        "xattr-ro" => false,
         
     | 
| 
       210 
     | 
    
         
            -
                        "xattr-rw" => false,
         
     | 
| 
       211 
     | 
    
         
            -
                        "no-allow-other" => false,
         
     | 
| 
       212 
     | 
    
         
            -
                        "realistic-permissions" => false,
         
     | 
| 
       213 
     | 
    
         
            -
                        "ctime-from-mtime" => false,
         
     | 
| 
       214 
     | 
    
         
            -
                        "hide-hard-links" => false,
         
     | 
| 
       215 
     | 
    
         
            -
                        "multithreaded" => false
         
     | 
| 
       216 
     | 
    
         
            -
                      }.freeze
         
     | 
| 
       217 
     | 
    
         
            -
                    end
         
     | 
| 
       218 
75 
     | 
    
         
             
                  end
         
     | 
| 
       219 
76 
     | 
    
         
             
                end
         
     | 
| 
       220 
77 
     | 
    
         
             
              end
         
     | 
| 
         @@ -0,0 +1,161 @@ 
     | 
|
| 
      
 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(machine, options)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @machine = machine
         
     | 
| 
      
 11 
     | 
    
         
            +
                    options  = normalize_keys(options)
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    @source       = options.delete("source-path")
         
     | 
| 
      
 14 
     | 
    
         
            +
                    @destination  = options.delete("dest-path")
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @arguments    = arguments_for(default_options.merge(options))
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  def build
         
     | 
| 
      
 19 
     | 
    
         
            +
                    [ "bindfs", arguments.join(" "), source, destination ].compact.join(" ")
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  protected
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  def arguments_for(options)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    available_options.reduce([]) do |args, (name, definition)|
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                      short = definition[:short].detect{ |k| options.key?(k) }
         
     | 
| 
      
 28 
     | 
    
         
            +
                      long  = definition[:long].detect{ |k| options.key?(k) }
         
     | 
| 
      
 29 
     | 
    
         
            +
                      value = case true
         
     | 
| 
      
 30 
     | 
    
         
            +
                                when !short.nil? then options[short]
         
     | 
| 
      
 31 
     | 
    
         
            +
                                when !long.nil?  then options[long]
         
     | 
| 
      
 32 
     | 
    
         
            +
                                else definition[:default]
         
     | 
| 
      
 33 
     | 
    
         
            +
                              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                      args << format_argument(name, definition, value) unless value.nil?
         
     | 
| 
      
 36 
     | 
    
         
            +
                      args
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end.compact
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  def format_argument(name, definition, value)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    if definition[:type] == :flag && !!value
         
     | 
| 
      
 42 
     | 
    
         
            +
                      return "-#{name}" if 0 == definition[:long].size # Shorthand only options
         
     | 
| 
      
 43 
     | 
    
         
            +
                      return "--#{name}"
         
     | 
| 
      
 44 
     | 
    
         
            +
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
                    if definition[:type] == :option
         
     | 
| 
      
 46 
     | 
    
         
            +
                      return "-#{name} #{value}" if 0 == definition[:long].size # Shorthand only options
         
     | 
| 
      
 47 
     | 
    
         
            +
                      return "--#{name}=#{value}"
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                  def normalize_keys(opts)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    {}.tap do |hash|
         
     | 
| 
      
 53 
     | 
    
         
            +
                      opts.each do |key, value|
         
     | 
| 
      
 54 
     | 
    
         
            +
                        hash[key.to_s.gsub("_", "-")] = value
         
     | 
| 
      
 55 
     | 
    
         
            +
                      end
         
     | 
| 
      
 56 
     | 
    
         
            +
                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                  def default_options
         
     | 
| 
      
 60 
     | 
    
         
            +
                    @default_options ||= normalize_keys(@machine.config.bindfs.default_options)
         
     | 
| 
      
 61 
     | 
    
         
            +
                  end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                  # TODO: Update after each bindfs release
         
     | 
| 
      
 64 
     | 
    
         
            +
                  def available_options
         
     | 
| 
      
 65 
     | 
    
         
            +
                    @available_options || begin
         
     | 
| 
      
 66 
     | 
    
         
            +
                      options = {
         
     | 
| 
      
 67 
     | 
    
         
            +
                        # File ownership
         
     | 
| 
      
 68 
     | 
    
         
            +
                        "force-user"            => { long: ["force-user", "user", "owner"], short: ["u"], type: :option,  default: "vagrant" },
         
     | 
| 
      
 69 
     | 
    
         
            +
                        "force-group"           => { long: ["force-group", "group"],        short: ["g"], type: :option,  default: "vagrant" },
         
     | 
| 
      
 70 
     | 
    
         
            +
                        "mirror"                => { long: ["mirror"],                      short: ["m"], type: :option,  default: nil },
         
     | 
| 
      
 71 
     | 
    
         
            +
                        "mirror-only"           => { long: ["mirror-only"],                 short: ["M"], type: :option,  default: nil },
         
     | 
| 
      
 72 
     | 
    
         
            +
                        "map"                   => { long: ["map"],                         short: [],    type: :option,  default: nil },
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                        # Permission bits
         
     | 
| 
      
 75 
     | 
    
         
            +
                        "perms"                 => { long: ["perms"],                       short: ["p"], type: :option,  default: "u=rwX:g=rD:o=rD" },
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                        # File creation policy
         
     | 
| 
      
 78 
     | 
    
         
            +
                        "create-as-user"        => { long: ["create-as-user"],              short: [],    type: :flag,    default: false },
         
     | 
| 
      
 79 
     | 
    
         
            +
                        "create-as-mounter"     => { long: ["create-as-mounter"],           short: [],    type: :flag,    default: false },
         
     | 
| 
      
 80 
     | 
    
         
            +
                        "create-for-user"       => { long: ["create-for-user"],             short: [],    type: :option,  default: nil },
         
     | 
| 
      
 81 
     | 
    
         
            +
                        "create-for-group"      => { long: ["create-for-group"],            short: [],    type: :option,  default: nil },
         
     | 
| 
      
 82 
     | 
    
         
            +
                        "create-with-perms"     => { long: ["create-with-perms"],           short: [],    type: :option,  default: nil },
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                        # Chown policy
         
     | 
| 
      
 85 
     | 
    
         
            +
                        "chown-normal"          => { long: ["chown-normal"],                short: [],    type: :flag,    default: false },
         
     | 
| 
      
 86 
     | 
    
         
            +
                        "chown-ignore"          => { long: ["chown-ignore"],                short: [],    type: :flag,    default: false },
         
     | 
| 
      
 87 
     | 
    
         
            +
                        "chown-deny"            => { long: ["chown-deny"],                  short: [],    type: :flag,    default: false },
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                        # Chgrp policy
         
     | 
| 
      
 90 
     | 
    
         
            +
                        "chgrp-normal"          => { long: ["chgrp-normal"],                short: [],    type: :flag,    default: false },
         
     | 
| 
      
 91 
     | 
    
         
            +
                        "chgrp-ignore"          => { long: ["chgrp-ignore"],                short: [],    type: :flag,    default: false },
         
     | 
| 
      
 92 
     | 
    
         
            +
                        "chgrp-deny"            => { long: ["chgrp-deny"],                  short: [],    type: :flag,    default: false },
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                        # Chmod policy
         
     | 
| 
      
 95 
     | 
    
         
            +
                        "chmod-normal"          => { long: ["chmod-normal"],                short: [],    type: :flag,    default: false },
         
     | 
| 
      
 96 
     | 
    
         
            +
                        "chmod-ignore"          => { long: ["chmod-ignore"],                short: [],    type: :flag,    default: false },
         
     | 
| 
      
 97 
     | 
    
         
            +
                        "chmod-deny"            => { long: ["chmod-deny"],                  short: [],    type: :flag,    default: false },
         
     | 
| 
      
 98 
     | 
    
         
            +
                        "chmod-filter"          => { long: ["chmod-filter"],                short: [],    type: :option,  default: nil },
         
     | 
| 
      
 99 
     | 
    
         
            +
                        "chmod-allow-x"         => { long: ["chmod-allow-x"],               short: [],    type: :flag,    default: false },
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                        # Extended attribute policy
         
     | 
| 
      
 102 
     | 
    
         
            +
                        "xattr-none"            => { long: ["xattr-none"],                  short: [],    type: :flag,    default: false },
         
     | 
| 
      
 103 
     | 
    
         
            +
                        "xattr-ro"              => { long: ["xattr-ro"],                    short: [],    type: :flag,    default: false },
         
     | 
| 
      
 104 
     | 
    
         
            +
                        "xattr-rw"              => { long: ["xattr-rw"],                    short: [],    type: :flag,    default: false },
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                        # Rate limits
         
     | 
| 
      
 107 
     | 
    
         
            +
                        "read-rate"             => { long: ["read-rate"],                   short: [],    type: :option,  default: false },
         
     | 
| 
      
 108 
     | 
    
         
            +
                        "write-rate"            => { long: ["write-rate"],                  short: [],    type: :option,  default: false },
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                        # Miscellaneous
         
     | 
| 
      
 111 
     | 
    
         
            +
                        "no-allow-other"        => { long: ["no-allow-other"],              short: ["n"], type: :flag,    default: false },
         
     | 
| 
      
 112 
     | 
    
         
            +
                        "realistic-permissions" => { long: ["realistic-permissions"],       short: [],    type: :flag,    default: false },
         
     | 
| 
      
 113 
     | 
    
         
            +
                        "ctime-from-mtime"      => { long: ["ctime-from-mtime"],            short: [],    type: :flag,    default: false },
         
     | 
| 
      
 114 
     | 
    
         
            +
                        "hide-hard-links"       => { long: ["hide-hard-links"],             short: [],    type: :flag,    default: false },
         
     | 
| 
      
 115 
     | 
    
         
            +
                        "multithreaded"         => { long: ["multithreaded"],               short: [],    type: :flag,    default: false },
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                        # FUSE options
         
     | 
| 
      
 118 
     | 
    
         
            +
                        "o"                     => { long: [],                              short: ["o"], type: :option,  default: nil },
         
     | 
| 
      
 119 
     | 
    
         
            +
                        "r"                     => { long: [],                              short: ["r"], type: :flag,    default: false },
         
     | 
| 
      
 120 
     | 
    
         
            +
                        "d"                     => { long: [],                              short: ["d"], type: :flag,    default: false },
         
     | 
| 
      
 121 
     | 
    
         
            +
                        "f"                     => { long: [],                              short: ["f"], type: :flag,    default: false },
         
     | 
| 
      
 122 
     | 
    
         
            +
                      }
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                      if bindfs_version_lower_than("1.12.6")
         
     | 
| 
      
 125 
     | 
    
         
            +
                        options.delete("read-rate")
         
     | 
| 
      
 126 
     | 
    
         
            +
                        options.delete("write-rate")
         
     | 
| 
      
 127 
     | 
    
         
            +
                      end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                      if bindfs_version_lower_than("1.12.2")
         
     | 
| 
      
 130 
     | 
    
         
            +
                        options.delete("chmod-filter")
         
     | 
| 
      
 131 
     | 
    
         
            +
                      end
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
                      if bindfs_version_lower_than("1.12")
         
     | 
| 
      
 134 
     | 
    
         
            +
                        options["user"]  = options.delete("force-user")
         
     | 
| 
      
 135 
     | 
    
         
            +
                        options["group"] = options.delete("force-group")
         
     | 
| 
      
 136 
     | 
    
         
            +
                      end
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
                      if bindfs_version_lower_than("1.11")
         
     | 
| 
      
 139 
     | 
    
         
            +
                        options.delete("multithreaded")
         
     | 
| 
      
 140 
     | 
    
         
            +
                      end
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
                      if bindfs_version_lower_than("1.10")
         
     | 
| 
      
 143 
     | 
    
         
            +
                        options.delete("map")
         
     | 
| 
      
 144 
     | 
    
         
            +
                        options.delete("realistic-permissions")
         
     | 
| 
      
 145 
     | 
    
         
            +
                        options.delete("hide-hard-links")
         
     | 
| 
      
 146 
     | 
    
         
            +
                      end
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
                      # Can't track changes deeper as SVN repository was removed from https://code.google.com/p/bindfs/
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                      options
         
     | 
| 
      
 151 
     | 
    
         
            +
                    end
         
     | 
| 
      
 152 
     | 
    
         
            +
                  end
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                  def bindfs_version_lower_than(version)
         
     | 
| 
      
 155 
     | 
    
         
            +
                    test_command = %{test "$(echo "%{v} $(sudo bindfs --version | cut -d" " -f2)" | tr " " "\n" | sort -V | tail -n 1)" == "%{v}"}
         
     | 
| 
      
 156 
     | 
    
         
            +
                    @machine.communicate.test(test_command % { v: version})
         
     | 
| 
      
 157 
     | 
    
         
            +
                  end
         
     | 
| 
      
 158 
     | 
    
         
            +
             
     | 
| 
      
 159 
     | 
    
         
            +
                end
         
     | 
| 
      
 160 
     | 
    
         
            +
              end
         
     | 
| 
      
 161 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -5,12 +5,12 @@ require 'vagrant/util/template_renderer' 
     | 
|
| 
       5 
5 
     | 
    
         
             
            module VagrantPlugins
         
     | 
| 
       6 
6 
     | 
    
         
             
              module Bindfs
         
     | 
| 
       7 
7 
     | 
    
         
             
                class Config < Vagrant.plugin("2", :config)
         
     | 
| 
       8 
     | 
    
         
            -
                  attr_accessor :default_options, :bind_folders
         
     | 
| 
      
 8 
     | 
    
         
            +
                  attr_accessor :default_options, :debug, :bind_folders
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                  def initialize
         
     | 
| 
       11 
11 
     | 
    
         
             
                    @default_options = UNSET_VALUE
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @debug = UNSET_VALUE
         
     | 
| 
       12 
13 
     | 
    
         
             
                    @bind_folders = {}
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
14 
     | 
    
         
             
                    @logger = Log4r::Logger.new('vagrantplugins::bindfs::config')
         
     | 
| 
       15 
15 
     | 
    
         
             
                  end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
         @@ -44,6 +44,7 @@ module VagrantPlugins 
     | 
|
| 
       44 
44 
     | 
    
         | 
| 
       45 
45 
     | 
    
         
             
                  def finalize!
         
     | 
| 
       46 
46 
     | 
    
         
             
                    @default_options = {} if @default_options == UNSET_VALUE
         
     | 
| 
      
 47 
     | 
    
         
            +
                    @debug = false if @debug == UNSET_VALUE
         
     | 
| 
       47 
48 
     | 
    
         
             
                  end
         
     | 
| 
       48 
49 
     | 
    
         | 
| 
       49 
50 
     | 
    
         
             
                  def validate!(machine)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: vagrant-bindfs
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Gaël-Ian Havard
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2014-10- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2014-10-10 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       15 
15 
     | 
    
         
             
            description: A Vagrant plugin to automate bindfs mount in the VM. This allow you to
         
     | 
| 
       16 
16 
     | 
    
         
             
              change owner, group and permissions on files and, for example, work around NFS share
         
     | 
| 
         @@ -22,18 +22,19 @@ executables: [] 
     | 
|
| 
       22 
22 
     | 
    
         
             
            extensions: []
         
     | 
| 
       23 
23 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       24 
24 
     | 
    
         
             
            files:
         
     | 
| 
       25 
     | 
    
         
            -
            - MIT-LICENSE
         
     | 
| 
       26 
     | 
    
         
            -
            - README.md
         
     | 
| 
       27 
     | 
    
         
            -
            - lib/vagrant-bindfs.rb
         
     | 
| 
       28 
25 
     | 
    
         
             
            - lib/vagrant-bindfs/bind.rb
         
     | 
| 
       29 
26 
     | 
    
         
             
            - lib/vagrant-bindfs/cap/debian/bindfs_install.rb
         
     | 
| 
       30 
27 
     | 
    
         
             
            - lib/vagrant-bindfs/cap/linux/bindfs_installed.rb
         
     | 
| 
       31 
28 
     | 
    
         
             
            - lib/vagrant-bindfs/cap/suse/bindfs_install.rb
         
     | 
| 
      
 29 
     | 
    
         
            +
            - lib/vagrant-bindfs/command.rb
         
     | 
| 
       32 
30 
     | 
    
         
             
            - lib/vagrant-bindfs/config.rb
         
     | 
| 
       33 
31 
     | 
    
         
             
            - lib/vagrant-bindfs/errors.rb
         
     | 
| 
       34 
32 
     | 
    
         
             
            - lib/vagrant-bindfs/plugin.rb
         
     | 
| 
       35 
33 
     | 
    
         
             
            - lib/vagrant-bindfs/version.rb
         
     | 
| 
      
 34 
     | 
    
         
            +
            - lib/vagrant-bindfs.rb
         
     | 
| 
       36 
35 
     | 
    
         
             
            - locales/en.yml
         
     | 
| 
      
 36 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 37 
     | 
    
         
            +
            - MIT-LICENSE
         
     | 
| 
       37 
38 
     | 
    
         
             
            homepage: https://github.com/gael-ian/vagrant-bindfs
         
     | 
| 
       38 
39 
     | 
    
         
             
            licenses:
         
     | 
| 
       39 
40 
     | 
    
         
             
            - MIT
         
     | 
| 
         @@ -44,17 +45,17 @@ require_paths: 
     | 
|
| 
       44 
45 
     | 
    
         
             
            - lib
         
     | 
| 
       45 
46 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       46 
47 
     | 
    
         
             
              requirements:
         
     | 
| 
       47 
     | 
    
         
            -
              - -  
     | 
| 
      
 48 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       48 
49 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       49 
50 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       50 
51 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
52 
     | 
    
         
             
              requirements:
         
     | 
| 
       52 
     | 
    
         
            -
              - -  
     | 
| 
      
 53 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       53 
54 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       54 
55 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       55 
56 
     | 
    
         
             
            requirements: []
         
     | 
| 
       56 
57 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       57 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 58 
     | 
    
         
            +
            rubygems_version: 2.0.14
         
     | 
| 
       58 
59 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       59 
60 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       60 
61 
     | 
    
         
             
            summary: A Vagrant plugin to automate bindfs mount in the VM
         
     |