Skip to content

Commit

Permalink
osx: Mount everything in /Volumes and / save those blacklisted in con…
Browse files Browse the repository at this point in the history
…tainer.

Ideally, this would mount /Applications as well but it's turning up empty in
the container. Perhaps boot2docker is getting in the way?

Also, looks like external drives are mounted in the container as read only.

refers #5

Signed-off-by: Anurag Priyam <[email protected]>
  • Loading branch information
yeban committed Jan 13, 2015
1 parent 945a49d commit 617e706
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ def unescape(mount)
# Mac OS X specific code.
module Darwin

# Read volumes mounted on the host from /Volumes.
#
# TODO:
# 1. Since when has Mac OS been putting all volumes in /Volumes?
# 2. Does everything mount to /Volumes in Mac? What about an sshfs volume?
# 2. Since when has Mac OS been calling the primary partition 'Macintosh HD'?
# 3. What would be an appropriate blacklist for Mac?
def mountpoints
volumes = Dir['/Volumes/*']
# Ignore common system mountpoints.
volumes.reject! {|mount| mount =~ /Macintosh HD/}
BLACKLIST =
%r{
(^/$)|
^/(bin|cores|dev|etc|home|Incompatible\ Software|
installer\.failurerequests|lost\+found|net|
Network|opt|private|sbin|System|Users|tmp|
usr|var|Volumes$)
}x

# Add home dir.
def mountpoints
volumes = Dir['/Volumes/*'].map {|v| File.symlink?(v) ? File.readlink(v) : v}
volumes = volumes | Dir['/*']
volumes.reject! { |mount| mount =~ BLACKLIST }
volumes << home
end
end
Expand Down

0 comments on commit 617e706

Please sign in to comment.