summaryrefslogtreecommitdiff
path: root/utils/lib.sh
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2020-01-20 19:08:56 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2020-01-20 19:08:56 +0100
commitaf2f58fc5847756d20741bb4c782f07943b0af60 (patch)
tree1c7e52b02d865fa330a85c98d780e44205654cc9 /utils/lib.sh
parent9b5a7f7559faf121e44ba3e7260290bd7efe74bf (diff)
downloadsearxng-af2f58fc5847756d20741bb4c782f07943b0af60.tar.gz
searxng-af2f58fc5847756d20741bb4c782f07943b0af60.zip
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>
Diffstat (limited to 'utils/lib.sh')
-rwxr-xr-xutils/lib.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/utils/lib.sh b/utils/lib.sh
index fadbcd648..40ecbb92e 100755
--- a/utils/lib.sh
+++ b/utils/lib.sh
@@ -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
# -----