Re: [PATCH v2] instaweb: make it compatible with Mac OS X 10.5's apache installation.
- From
nathan spindel <nathans@gmail.com>
- Date
- May 13, 2008, 02:54 UTC
- Message-ID
- <21CA1226-223D-4347-A119-1D5A2CEA003E@gmail.com>
- In-Reply-To
- <7v7idzz7no.fsf@gitster.siamese.dyndns.org>
On May 12, 2008, at 11:42 AM, Junio C Hamano wrote:
Show 22 quoted lines
> Christian Couder <chriscool@tuxfamily.org> writes:
>
>> Maybe you can use a function like this not tested one:
>>
>> check_cmd() {
>> cmd="$1"
>>
>> if type "$cmd" > /dev/null 2>&1; then
>> if "$cmd" -v | grep Apache > /dev/null 2>&1; then
>> httpd=$(echo "$cmd" | sed "s/apache2/httpd/")
>> fi
>> fi
>> }
>
> One worry I have with that approach is if any and all random
> implementations of "httpd" that live somewhere in path do not do any
> harm
> when started with "-v" option. Namely, they should exit without
> becoming
> a daemon and/or start the service.
>
> I am not convinced that would be the case.I agree with that worry. Solving that in the general case is pretty difficult, so I think we could instead look for other clues in the system. Some ideas:
- Use $HTTPD as defined in apachectl. (How portable is that?)
- Inspect the text of 'man httpd' to determine if it's Apache or not.
- Only fallback on the httpd command on Mac OS X 10.5? That's pretty safe.