git-instaweb: Don't assume Apache executable is named apache2

On Arch Linux, the executable for the Apache HTTP server keeps
the 'httpd' name and is not named 'apache2'. The path to the
server modules also contains 'httpd' rather than 'apache2'.
Remove some of these assumptions and add the httpd name in where
it may be required. Finally, make some slight style adjustments
to the code we are touching to make it fit the style of the rest
of the script.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
Dan McGee 2010-06-30 07:29:08 -05:00 коммит произвёл Eric Wong
Родитель 2989f516d5
Коммит 4bdf85995b
1 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -43,7 +43,8 @@ test -z "$port" && port=1234
resolve_full_httpd () { resolve_full_httpd () {
case "$httpd" in case "$httpd" in
*apache2*|*lighttpd*) *apache2*|*lighttpd*|*httpd*)
# yes, *httpd* covers *lighttpd* above, but it is there for clarity
# ensure that the apache2/lighttpd command ends with "-f" # ensure that the apache2/lighttpd command ends with "-f"
if ! echo "$httpd" | sane_grep -- '-f *$' >/dev/null 2>&1 if ! echo "$httpd" | sane_grep -- '-f *$' >/dev/null 2>&1
then then
@ -300,7 +301,13 @@ EOF
} }
apache2_conf () { apache2_conf () {
test -z "$module_path" && module_path=/usr/lib/apache2/modules if test -z "$module_path"
then
test -d "/usr/lib/httpd/modules" &&
module_path="/usr/lib/httpd/modules"
test -d "/usr/lib/apache2/modules" &&
module_path="/usr/lib/apache2/modules"
fi
bind= bind=
test x"$local" = xtrue && bind='127.0.0.1:' test x"$local" = xtrue && bind='127.0.0.1:'
echo 'text/css css' > "$fqgitdir/mime.types" echo 'text/css css' > "$fqgitdir/mime.types"
@ -314,8 +321,10 @@ PidFile "$fqgitdir/pid"
Listen $bind$port Listen $bind$port
EOF EOF
for mod in mime dir env log_config; do for mod in mime dir env log_config
if test -e $module_path/mod_${mod}.so; then do
if test -e $module_path/mod_${mod}.so
then
echo "LoadModule ${mod}_module " \ echo "LoadModule ${mod}_module " \
"$module_path/mod_${mod}.so" >> "$conf" "$module_path/mod_${mod}.so" >> "$conf"
fi fi
@ -563,7 +572,7 @@ case "$httpd" in
*lighttpd*) *lighttpd*)
lighttpd_conf lighttpd_conf
;; ;;
*apache2*) *apache2*|*httpd*)
apache2_conf apache2_conf
;; ;;
webrick) webrick)