Created
June 17, 2011 21:04
-
-
Save spheromak/1032345 to your computer and use it in GitHub Desktop.
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
# 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