Skip to content

Instantly share code, notes, and snippets.

@spheromak
Created June 17, 2011 21:04
Show Gist options
  • Save spheromak/1032345 to your computer and use it in GitHub Desktop.
Save spheromak/1032345 to your computer and use it in GitHub Desktop.
# is this damn thing already mounted ?
def is_mounted?(device)
check_mount = Chef::ShellOut.new("mount | grep -q '#{device}'")
check_mount.run_command
return true if 0 == check_mount.status
# might as well follow the link like mount does
# recursion is fun
return is_mounted?(Pathname.new(device).realpath.to_s) if File.symlink?(device)
false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment