{"thread":{"id":"4991","subject":"[PATCH 4/5] git-instaweb: Fall back to Apache when LigHTTP was not found","startedAt":"2006-07-26T14:34:10Z","lastAt":"2006-07-26T21:11:46Z","messageCount":4,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"24133","messageId":"Pine.LNX.4.63.0607261633560.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4991","inReplyTo":null,"subject":"[PATCH 4/5] git-instaweb: Fall back to Apache when LigHTTP was not found","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-07-26T14:34:10Z","receivedAt":"2006-07-26T14:34:10Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nApache is more likely to be installed...\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n git-instaweb.sh |   12 +++++++++---\n 1 files changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 1d3ea73..242b55e 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -25,9 +25,6 @@ conf=$GIT_DIR/gitweb/httpd.conf\n \n # Defaults:\n \n-# if installed, it doesn't need further configuration (module_path)\n-test -z \"$httpd\" && httpd='lighttpd -f'\n-\n # probably the most popular browser among gitweb users\n test -z \"$browser\" && browser='firefox'\n \n@@ -135,6 +132,15 @@ do\n \tshift\n done\n \n+# if installed, it doesn't need further configuration (module_path)\n+if [ -z \"$httpd\" ]; then\n+\thttpd='lighttpd -f'\n+\twhich \"$httpd\" >/dev/null 2>&1 || httpd='apache2 -f'\n+\twhich \"$httpd\" >/dev/null 2>&1 || httpd='apache -f'\n+\twhich \"$httpd\" >/dev/null 2>&1 || httpd='httpd -f'\n+\twhich \"$httpd\" >/dev/null || exit 1\n+fi\n+\n mkdir -p \"$GIT_DIR/gitweb/tmp\"\n GIT_EXEC_PATH=\"`git --exec-path`\"\n GIT_DIR=\"$fqgitdir\"\n-- \n1.4.2.rc2.g6a4e\n"},{"id":"24156","messageId":"7vr708qih4.fsf@assigned-by-dhcp.cox.net","threadId":"4991","inReplyTo":"Pine.LNX.4.63.0607261633560.29667@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH 4/5] git-instaweb: Fall back to Apache when LigHTTP was not found","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-26T19:22:31Z","receivedAt":"2006-07-26T19:22:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Apache is more likely to be installed...\n>\n> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n> ---\n>  git-instaweb.sh |   12 +++++++++---\n>  1 files changed, 9 insertions(+), 3 deletions(-)\n>\n> diff --git a/git-instaweb.sh b/git-instaweb.sh\n> index 1d3ea73..242b55e 100755\n> --- a/git-instaweb.sh\n> +++ b/git-instaweb.sh\n> @@ -25,9 +25,6 @@ conf=$GIT_DIR/gitweb/httpd.conf\n>  \n>  # Defaults:\n>  \n> -# if installed, it doesn't need further configuration (module_path)\n> -test -z \"$httpd\" && httpd='lighttpd -f'\n> -\n>  # probably the most popular browser among gitweb users\n>  test -z \"$browser\" && browser='firefox'\n>  \n> @@ -135,6 +132,15 @@ do\n>  \tshift\n>  done\n>  \n> +# if installed, it doesn't need further configuration (module_path)\n> +if [ -z \"$httpd\" ]; then\n> +\thttpd='lighttpd -f'\n> +\twhich \"$httpd\" >/dev/null 2>&1 || httpd='apache2 -f'\n> +\twhich \"$httpd\" >/dev/null 2>&1 || httpd='apache -f'\n> +\twhich \"$httpd\" >/dev/null 2>&1 || httpd='httpd -f'\n> +\twhich \"$httpd\" >/dev/null || exit 1\n> +fi\n> +\n\nPlease don't use \"which\" in scripts.  Consult this thread:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/23382/focus=23394\n"},{"id":"24159","messageId":"Pine.LNX.4.63.0607262153380.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4991","inReplyTo":"7vr708qih4.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 4/5] git-instaweb: Fall back to Apache when LigHTTP was not found","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-07-26T19:57:18Z","receivedAt":"2006-07-26T19:57:18Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 26 Jul 2006, Junio C Hamano wrote:\n\n> Please don't use \"which\" in scripts.  Consult this thread:\n> \n> http://thread.gmane.org/gmane.comp.version-control.git/23382/focus=23394\n\nI remembered vaguely, so I searched in git-instaweb:\n\n$ git grep -n which next:git-instaweb.sh\nnext:git-instaweb.sh:40: [white space...] which $httpd_only >/dev/null\n\nWell, the fallback mechanism might not be that useful anyway: if you have \napache, you have to specify the modules path. I'll do a patch instead \nwhich exits cleanly if either $httpd or $browser could not be executed, \nokay?\n\nCiao,\nDscho\n"},{"id":"24165","messageId":"Pine.LNX.4.63.0607262310350.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4991","inReplyTo":"Pine.LNX.4.63.0607262153380.29667@wbgn013.biozentrum.uni-wuerzburg.de","subject":"[PATCH] instaweb: Be more clear if httpd or the browser fail","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-07-26T21:11:46Z","receivedAt":"2006-07-26T21:11:46Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\nOn Wed, 26 Jul 2006, Johannes Schindelin wrote:\n\n> Well, the fallback mechanism might not be that useful anyway: if you have \n> apache, you have to specify the modules path. I'll do a patch instead \n> which exits cleanly if either $httpd or $browser could not be executed, \n> okay?\n\nHere you are\n\n git-instaweb.sh |    9 +++++++--\n 1 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 1d3ea73..585ad7c 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -54,6 +54,10 @@ start_httpd () {\n \t\t\tfi\n \t\tdone\n \tfi\n+\tif test $? != 0; then\n+\t\techo \"Could not execute http daemon $httpd.\"\n+\t\texit 1\n+\tfi\n }\n \n stop_httpd () {\n@@ -189,7 +193,7 @@ EOF\n \telse\n \t\t# plain-old CGI\n \t\tlist_mods=`echo \"$httpd\" | sed \"s/-f$/-l/\"`\n-\t\t$list_mods | grep 'mod_cgi\\.c' >/dev/null || \\\n+\t\t$list_mods | grep 'mod_cgi\\.c' >/dev/null 2>&1 || \\\n \t\techo \"LoadModule cgi_module $module_path/mod_cgi.so\" >> \"$conf\"\n \t\tcat >> \"$conf\" <<EOF\n AddHandler cgi-script .cgi\n@@ -239,4 +243,5 @@ esac\n \n start_httpd\n test -z \"$browser\" && browser=echo\n-$browser http://127.0.0.1:$port\n+url=http://127.0.0.1:$port\n+$browser $url || echo $url\n-- \n1.4.2.rc2.g84db\n"}]}