utils/filtron.sh: add script to install filtron middleware (apache)

Preparation for the installation of an apache site.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-01-20 19:08:56 +01:00
parent 9b5a7f7559
commit af2f58fc58
3 changed files with 154 additions and 19 deletions

View file

@ -359,6 +359,59 @@ install_template() {
done
}
# Apache
# ------
# FIXME: Arch Linux & RHEL should be added
if [[ -z "${APACHE_SITES_AVAILABE}" ]]; then
APACHE_SITES_AVAILABE="/etc/apache2/sites-available"
fi
apache_is_installed() {
(command -v apachectl \
&& command -v a2ensite \
&& command -v a2dissite ) &>/dev/null
}
apache_reload() {
info_msg "reload apache .."
echo
sudo -H apachectl configtest
sudo -H service apache2 force-reload
}
apache_install_site() {
# usage: apache_install_site [--no-eval] <mysite.conf>
local no_eval=""
local CONF="$1"
if [[ "$1" == "--no-eval" ]]; then
no_eval=$1; shift
fi
# shellcheck disable=SC2086
install_template $no_eval "${APACHE_SITES_AVAILABE}/${CONF}" root root 644
apache_enable_site "${CONF}"
apache_reload
info_msg "installed apache site: ${CONF}"
}
apache_enable_site() {
info_msg "enable apache site $1 .."
sudo -H a2ensite -q "$1"
apache_reload
}
apache_dissable_site() {
info_msg "disable apache site $1 .."
sudo -H a2dissite -q "$1"
apache_reload
}
# uWSGI
# -----