Re: [PATCH] instaweb: if no httpd is specified and lighttpd doesn't exist, fall back on apache2.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



nathan spindel <nathans@xxxxxxxxx> writes:

> Signed-off-by: nathan spindel <nathans@xxxxxxxxx>
> ---
>  git-instaweb.sh |   12 ++++++++++--
>  1 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/git-instaweb.sh b/git-instaweb.sh
> index 6f91c8f..b744133 100755
> --- a/git-instaweb.sh
> +++ b/git-instaweb.sh
> @@ -31,8 +31,16 @@ conf="$GIT_DIR/gitweb/httpd.conf"
>  
>  # Defaults:
>  
> -# if installed, it doesn't need further configuration (module_path)
> -test -z "$httpd" && httpd='lighttpd -f'
> +# use lighttpd if it exists, otherwise use apache2
> +if test -z "$httpd"
> +then
> +	if type "lighttpd" > /dev/null 2>&1;

The exit code from "type" is very loosely defined by POSIX which just says
it exits >0 to signal that "an error occured".  Presumably it means there
is no such command that is executable on the $PATH, and it may be more
portable and reliable than using "which", but this still worries me.

Doesn't "lighttpd" have an option that reports "I am here" and exit 0,
e.g. "--version"?  Then we could instead say:

	if lighttpd --version >/dev/null
        then
        	... use it ...

and that would be much nicer...
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux