From 617e70665844362544ec1e04a087caf733d1c24c Mon Sep 17 00:00:00 2001 From: Anurag Priyam Date: Tue, 13 Jan 2015 16:52:58 +0530 Subject: [PATCH] osx: Mount everything in /Volumes and / save those blacklisted in container. 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 --- lib/switch.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/switch.rb b/lib/switch.rb index e4d9558..02ee208 100644 --- a/lib/switch.rb +++ b/lib/switch.rb @@ -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