Skip to content

Commit

Permalink
sshfs_reverse_mount: create guest directory if not exists
Browse files Browse the repository at this point in the history
If the directory inside the guest doesn't exist then let's
create it in the reverse mount case too.

Fixes #94
  • Loading branch information
dustymabe committed Jun 20, 2022
1 parent 08c1c83 commit bf72f0f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/vagrant-sshfs/cap/host/darwin/sshfs_reverse_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def self.sshfs_mount(machine, opts)
expanded_guest_path = machine.guest.capability(
:shell_expand_guest_path, opts[:guestpath])

# Create the mountpoint inside the guest
machine.communicate.tap do |comm|
comm.sudo("mkdir -p #{expanded_guest_path}")
comm.sudo("chmod 777 #{expanded_guest_path}")
end

# Mount path information
hostpath = opts[:hostpath].dup
hostpath.gsub!("'", "'\\\\''")
Expand Down
6 changes: 6 additions & 0 deletions lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ def self.sshfs_mount(machine, opts)
expanded_guest_path = machine.guest.capability(
:shell_expand_guest_path, opts[:guestpath])

# Create the mountpoint inside the guest
machine.communicate.tap do |comm|
comm.sudo("mkdir -p #{expanded_guest_path}")
comm.sudo("chmod 777 #{expanded_guest_path}")
end

# Mount path information
hostpath = opts[:hostpath].dup
hostpath.gsub!("'", "'\\\\''")
Expand Down

0 comments on commit bf72f0f

Please sign in to comment.