def detect_one(apxs2)
log "<banner>Analyzing #{apxs2}...</banner>"
add_result do |result|
result.apxs2 = apxs2
log "Detecting main Apache executable..."
result.httpd = PlatformInfo.httpd(:apxs2 => apxs2)
if result.httpd
log "Detecting version..."
if result.version = PlatformInfo.httpd_version(:httpd => result.httpd)
log " --> #{result.version}"
else
log "<red> --> Cannot detect version!</red>"
result.httpd = nil
end
end
if result.httpd
log "Detecting control command..."
result.ctl = PlatformInfo.apache2ctl(:apxs2 => apxs2)
result.httpd = nil if !result.ctl
end
if result.httpd
log "Detecting configuration file location..."
result.config_file = PlatformInfo.httpd_default_config_file(:httpd => result.httpd)
if result.config_file
log " --> #{result.config_file}"
else
log "<red> --> Cannot detect default config file location!</red>"
result.httpd = nil
end
end
if result.httpd
log "Detecting error log file..."
result.error_log = PlatformInfo.httpd_actual_error_log(:httpd => result.httpd)
if result.error_log
log " --> #{result.error_log}"
else
log "<red> --> Cannot detect error log file!</red>"
end
end
if result.httpd
log "Detecting a2enmod and a2dismod..."
result.a2enmod = PlatformInfo.a2enmod(:apxs2 => apxs2)
result.a2dismod = PlatformInfo.a2dismod(:apxs2 => apxs2)
end
if result.httpd
log "<green>Found a usable Apache installation using #{apxs2}.</green>"
true
else
log "<yellow>Cannot find a usable Apache installation using #{apxs2}.</yellow>"
false
end
end
log ""
end