Clean up apache 2.2 cruft from Ubuntu 12.04
All the apache 2.2 handling is obsolete now, as we don't support those distros, so get rid of it. Change-Id: I9c0f78af2b32afabb2c4264aebc92089c4694f91
This commit is contained in:
parent
3d4c6d2dd1
commit
8f8b274e60
48
lib/apache
48
lib/apache
|
@ -90,49 +90,15 @@ function install_apache_wsgi {
|
|||
fi
|
||||
# WSGI isn't enabled by default, enable it
|
||||
enable_apache_mod wsgi
|
||||
|
||||
# ensure mod_version enabled for <IfVersion ...>. This is
|
||||
# built-in statically on anything recent, but precise (2.2)
|
||||
# doesn't have it enabled
|
||||
sudo a2enmod version || true
|
||||
}
|
||||
|
||||
# get_apache_version() - return the version of Apache installed
|
||||
# This function is used to determine the Apache version installed. There are
|
||||
# various differences between Apache 2.2 and 2.4 that warrant special handling.
|
||||
function get_apache_version {
|
||||
if is_ubuntu; then
|
||||
local version_str
|
||||
version_str=$(sudo /usr/sbin/apache2ctl -v | awk '/Server version/ {print $3}' | cut -f2 -d/)
|
||||
elif is_fedora; then
|
||||
local version_str
|
||||
version_str=$(rpm -qa --queryformat '%{VERSION}' httpd)
|
||||
elif is_suse; then
|
||||
local version_str
|
||||
version_str=$(rpm -qa --queryformat '%{VERSION}' apache2)
|
||||
else
|
||||
exit_distro_not_supported "cannot determine apache version"
|
||||
fi
|
||||
if [[ "$version_str" =~ ^2\.2\. ]]; then
|
||||
echo "2.2"
|
||||
elif [[ "$version_str" =~ ^2\.4\. ]]; then
|
||||
echo "2.4"
|
||||
else
|
||||
exit_distro_not_supported "apache version not supported"
|
||||
fi
|
||||
}
|
||||
|
||||
# apache_site_config_for() - The filename of the site's configuration file.
|
||||
# This function uses the global variables APACHE_NAME and APACHE_CONF_DIR.
|
||||
#
|
||||
# On Ubuntu 14.04, the site configuration file must have a .conf suffix for a2ensite and a2dissite to
|
||||
# On Ubuntu 14.04+, the site configuration file must have a .conf suffix for a2ensite and a2dissite to
|
||||
# recognise it. a2ensite and a2dissite ignore the .conf suffix used as parameter. The default sites'
|
||||
# files are 000-default.conf and default-ssl.conf.
|
||||
#
|
||||
# On Ubuntu 12.04, the site configuration file may have any format, as long as it is in
|
||||
# /etc/apache2/sites-available/. a2ensite and a2dissite need the entire file name to work. The default
|
||||
# sites' files are default and default-ssl.
|
||||
#
|
||||
# On Fedora and openSUSE, any file in /etc/httpd/conf.d/ whose name ends with .conf is enabled.
|
||||
#
|
||||
# On RHEL and CentOS, things should hopefully work as in Fedora.
|
||||
|
@ -141,22 +107,14 @@ function get_apache_version {
|
|||
# +----------------------+--------------------+--------------------------+--------------------------+
|
||||
# | Distribution | File name | Site enabling command | Site disabling command |
|
||||
# +----------------------+--------------------+--------------------------+--------------------------+
|
||||
# | Ubuntu 12.04 | site | a2ensite site | a2dissite site |
|
||||
# | Ubuntu 14.04 | site.conf | a2ensite site | a2dissite site |
|
||||
# | Fedora, RHEL, CentOS | site.conf.disabled | mv site.conf{.disabled,} | mv site.conf{,.disabled} |
|
||||
# +----------------------+--------------------+--------------------------+--------------------------+
|
||||
function apache_site_config_for {
|
||||
local site=$@
|
||||
if is_ubuntu; then
|
||||
local apache_version
|
||||
apache_version=$(get_apache_version)
|
||||
if [[ "$apache_version" == "2.2" ]]; then
|
||||
# Ubuntu 12.04 - Apache 2.2
|
||||
echo $APACHE_CONF_DIR/${site}
|
||||
else
|
||||
# Ubuntu 14.04 - Apache 2.4
|
||||
echo $APACHE_CONF_DIR/${site}.conf
|
||||
fi
|
||||
# Ubuntu 14.04 - Apache 2.4
|
||||
echo $APACHE_CONF_DIR/${site}.conf
|
||||
elif is_fedora || is_suse; then
|
||||
# fedora conf.d is only imported if it ends with .conf so this is approx the same
|
||||
local enabled_site_file="$APACHE_CONF_DIR/${site}.conf"
|
||||
|
|
Loading…
Reference in New Issue