Some distributions include the Apache httpd server as just "httpd", but
specifying the option --httpd=httpd doesn't work, as git-instaweb uses
the program name to detect the type of server used.
Now the output if $httpd -v is used to also detect the server type.
Remove also the hard-coded path to apache2 modules, use apache2's
compilation options.
Signed-off-by: Luciano M. F. Rocha <luciano@eurotux.com>
---
git-instaweb.sh | 137 +++++++++++++++++++++++++++++++-----------------------
1 files changed, 79 insertions(+), 58 deletions(-)
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 0843372..8c5aeb2 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -31,53 +31,84 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# Defaults:
-# if installed, it doesn't need further configuration (module_path)
-test -z "$httpd" && httpd='lighttpd -f'
-
# any untaken local port will do...
test -z "$port" && port=1234
-resolve_full_httpd () {
- case "$httpd" in
- *apache2*|*lighttpd*)
- # ensure that the apache2/lighttpd command ends with "-f"
- if ! echo "$httpd" | grep -- '-f *$' >/dev/null 2>&1
- then
- httpd="$httpd -f"
- fi
- ;;
- esac
+# add sbin directories to path, usually not done for normal users
+PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
- httpd_only="$(echo $httpd | cut -f1 -d' ')"
- if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null;; esac
- then
- full_httpd=$httpd
- else
- # many httpds are installed in /usr/sbin or /usr/local/sbin
- # these days and those are not in most users $PATHs
- # in addition, we may have generated a server script
- # in $fqgitdir/gitweb.
- for i in /usr/local/sbin /usr/sbin "$fqgitdir/gitweb"
- do
- if test -x "$i/$httpd_only"
- then
- full_httpd=$i/$httpd
- return
- fi
- done
-
- echo >&2 "$httpd_only not found. Install $httpd_only or use" \
- "--httpd to specify another httpd daemon."
- exit 1
- fi
-}
+# in addition, we may have generated a server script in ...