[PATCH 1/1] git-instaweb: support for apache2/lighttpd by other names

Previous thread: [EGIT PATCH v2 01/12] Add support code to handle plugin property changes by Tor Arne Vestbø on Wednesday, February 11, 2009 - 11:40 am. (21 messages)

Next thread: none
From: Luciano Miguel Ferreira Rocha
Date: Wednesday, February 11, 2009 - 11:40 am

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 ...
From: Luciano Miguel Ferreira Rocha
Date: Tuesday, June 16, 2009 - 2:02 am

<snip>

I got no replies. Is there any interest in this? Or in a pure perl
server option?

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>
Previous thread: [EGIT PATCH v2 01/12] Add support code to handle plugin property changes by Tor Arne Vestbø on Wednesday, February 11, 2009 - 11:40 am. (21 messages)

Next thread: none