# File lib/specinfra/processor.rb, line 84
    def self.check_file_is_mounted(path, expected_attr, only_with)
      cmd = Specinfra.command.get(:check_file_is_mounted, path)
      ret = Specinfra.backend.run_command(cmd)
      if expected_attr.nil? || ret.failure?
        return ret.success?
      end

      mount = ret.stdout.scan(/\S+/)
      actual_attr = { }
      actual_attr[:device] = mount[0]
      # Output of mount depends on os:
      # a)  proc on /proc type proc (rw,noexec,nosuid,nodev)
      # b)  procfs on /proc (procfs, local)
      actual_attr[:type] = mount[4] if mount[3] == 'type' # case a.
      if match = ret.stdout.match(/\((.*)\)/)
        options = match[1].split(',')
        actual_attr[:type] ||= options.shift              # case b.
        options.each do |option|
          name, val = option.split('=')
          if val.nil?
            actual_attr[name.strip.to_sym] = true
          else
            val = val.to_i if val.match(/^\d+$/)
            actual_attr[name.strip.to_sym] = val
          end
        end
      end

      if ! expected_attr[:options].nil?
        expected_attr.merge!(expected_attr[:options])
        expected_attr.delete(:options)
      end

      if only_with
        actual_attr == expected_attr
      else
        expected_attr.each do |key, val|
          return false if actual_attr[key] != val
        end
        true
      end
    end