Created
September 3, 2010 16:30
-
-
Save rjungemann/564134 to your computer and use it in GitHub Desktop.
Script to mount a filesystem with MacFUSE, then copy its address to the clipboard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# simply copy an ip address to your clipboard, then run: | |
# ./drivel.rb | |
# to mount an sshfs partition and open it up in Finder.app. To unmount, run: | |
# ./drivel.rb unmount | |
# requires a Mac running MacFUSE and sshfs | |
host = `pbpaste` | |
prefix = host.include?("@") ? "@" : "" | |
suffix = host.include?(":") ? ":" : "" | |
dirname = host.match("#{prefix}(.+)#{suffix}")[1] | |
suffixed_host = host.include?(":") ? host : "#{host}:" | |
puts "creating #{host} at the directory #{dirname}" | |
if ARGV.first == "unmount" | |
`cd /Volumes && umount #{dirname} && rm -rf #{dirname}` | |
else | |
`cd /Volumes && mkdir #{dirname} && \ | |
sshfs #{suffixed_host} #{dirname} && open #{dirname}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment