def self.find_apache2_executable(*possible_names)
if possible_names.last.is_a?(Hash)
options = possible_names.pop
options = nil if options.empty?
end
if options
dirs = options[:dirs] || [apache2_bindir(options), apache2_sbindir(options)]
else
dirs = [apache2_bindir, apache2_sbindir]
end
dirs.each do |bindir|
if bindir.nil?
next
end
possible_names.each do |name|
filename = "#{bindir}/#{name}"
if !File.exist?(filename)
log "Looking for #{filename}: not found"
elsif !File.file?(filename)
log "Looking for #{filename}: found, but is not a file"
elsif !File.executable?(filename)
log "Looking for #{filename}: found, but is not executable"
else
log "Looking for #{filename}: found"
return filename
end
end
end
return nil
end