From fa378a40d41cbffed64b8b85394cb76c6303ef64 Mon Sep 17 00:00:00 2001
From: Sebastian Kisela <skisela@redhat.com>
Date: Tue, 26 Jun 2018 23:39:37 +0200
Subject: [PATCH] Switch git instaweb default to apache
On Fedora-derived systems, the apache httpd package installs modules
under /usr/lib{,64}/httpd/modules, depending on whether the system is
32- or 64-bit. A symlink from /etc/httpd/modules is created which
points to the proper module path. Use it to support apache on Fedora,
CentOS, and Red Hat systems.
References upstream commit: 1976311aa285549599e5a451d7ad72b55a2b60e2
---
git-instaweb.sh | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 01a1b05..06380b6 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -34,7 +34,7 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# Defaults:
# if installed, it doesn't need further configuration (module_path)
-test -z "$httpd" && httpd='lighttpd -f'
+test -z "$httpd" && httpd='httpd -f'
# Default is @@GITWEBDIR@@
test -z "$root" && root='@@GITWEBDIR@@'
@@ -324,13 +324,17 @@ EOF
}
apache2_conf () {
- if test -z "$module_path"
- then
- test -d "/usr/lib/httpd/modules" &&
- module_path="/usr/lib/httpd/modules"
- test -d "/usr/lib/apache2/modules" &&
- module_path="/usr/lib/apache2/modules"
- fi
+ for candidate in \
+ /etc/httpd \
+ /usr/lib/apache2 \
+ /usr/lib/httpd ;
+ do
+ if test -d "$candidate/modules"
+ then
+ module_path="$candidate/modules"
+ break
+ fi
+ done
bind=
test x"$local" = xtrue && bind='127.0.0.1:'
echo 'text/css css' > "$fqgitdir/mime.types"
@@ -344,7 +348,17 @@ PidFile "$fqgitdir/pid"
Listen $bind$port
EOF
- for mod in mime dir env log_config
+ for mod in mpm_event mpm_prefork mpm_worker
+ do
+ if test -e $module_path/mod_${mod}.so
+ then
+ echo "LoadModule ${mod}_module " \
+ "$module_path/mod_${mod}.so" >> "$conf"
+ # only one mpm module permitted
+ break
+ fi
+ done
+ for mod in mime dir env log_config authz_core unixd
do
if test -e $module_path/mod_${mod}.so
then
--
2.14.4