From: Junio C Hamano Date: Wed, 26 Jul 2006 19:22:31 GMT Subject: Re: [PATCH 4/5] git-instaweb: Fall back to Apache when LigHTTP was not found Message-ID: <7vr708qih4.fsf@assigned-by-dhcp.cox.net> In-Reply-To: Johannes Schindelin writes: > Apache is more likely to be installed... > > Signed-off-by: Johannes Schindelin > --- > git-instaweb.sh | 12 +++++++++--- > 1 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/git-instaweb.sh b/git-instaweb.sh > index 1d3ea73..242b55e 100755 > --- a/git-instaweb.sh > +++ b/git-instaweb.sh > @@ -25,9 +25,6 @@ conf=$GIT_DIR/gitweb/httpd.conf > > # Defaults: > > -# if installed, it doesn't need further configuration (module_path) > -test -z "$httpd" && httpd='lighttpd -f' > - > # probably the most popular browser among gitweb users > test -z "$browser" && browser='firefox' > > @@ -135,6 +132,15 @@ do > shift > done > > +# if installed, it doesn't need further configuration (module_path) > +if [ -z "$httpd" ]; then > + httpd='lighttpd -f' > + which "$httpd" >/dev/null 2>&1 || httpd='apache2 -f' > + which "$httpd" >/dev/null 2>&1 || httpd='apache -f' > + which "$httpd" >/dev/null 2>&1 || httpd='httpd -f' > + which "$httpd" >/dev/null || exit 1 > +fi > + Please don't use "which" in scripts. Consult this thread: http://thread.gmane.org/gmane.comp.version-control.git/23382/focus=23394