Created
October 7, 2012 13:17
-
-
Save julik/3848380 to your computer and use it in GitHub Desktop.
Manually mount HFS shares on OSX
This file contains 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 | |
require 'fileutils' | |
MOUNTZ = %w( | |
some-server.company.local:/mnt/raiddisk/commercial /mnt/commercial | |
) | |
SERVERS = Hash[*MOUNTZ] | |
MAGIC_OPTS = %w( soft resvport intr rsize=8192 wsize=8192 timeo=900 retrans=3 proto=tcp ) | |
def unmount | |
SERVERS.each_value do | mountpoint | | |
`sudo umount #{mountpoint}` | |
# Make sure the mountpoint is removed for the next launch | |
FileUtils.rmdir(mountpoint) if File.exist?(mountpoint) | |
end | |
end | |
def mount | |
unmount | |
SERVERS.each_pair do | host, mountpoint | | |
FileUtils.mkdir_p(mountpoint) | |
# Make sure its mega-writable | |
File.chmod(0777, mountpoint) | |
`sudo mount -t nfs -o #{MAGIC_OPTS.join(',')} #{host} #{mountpoint}` | |
end | |
end | |
if ARGV.to_s.include?("unmount") | |
unmount | |
else | |
unmount | |
mount | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment