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>
Dan McGee committed
Jun 30, 2010 at 07:29 UTC
4bdf85995b5d21fdb085a480d529c8da0314189e
1 file changed
+14
-5
git-instaweb.sh
+14
-5
@@ -43,7 +43,8 @@ test -z "$port" && port=1234
43
44
resolve_full_httpd () {
45
case "$httpd" in
46
- *apache2*|*lighttpd*)
46
+ *apache2*|*lighttpd*|*httpd*)
47
+ # yes, *httpd* covers *lighttpd* above, but it is there for clarity
48
# ensure that the apache2/lighttpd command ends with "-f"
49
if ! echo "$httpd" | sane_grep -- '-f *$' >/dev/null 2>&1
50
then
@@ -300,7 +301,13 @@ EOF
301
}
302
303
apache2_conf () {
303
- test -z "$module_path" && module_path=/usr/lib/apache2/modules
304
+ if test -z "$module_path"
305
+ then
306
+ test -d "/usr/lib/httpd/modules" &&
307
+ module_path="/usr/lib/httpd/modules"
308
+ test -d "/usr/lib/apache2/modules" &&
309
+ module_path="/usr/lib/apache2/modules"
310
+ fi
311
bind=
312
test x"$local" = xtrue && bind='127.0.0.1:'
313
echo 'text/css css' > "$fqgitdir/mime.types"
@@ -314,8 +321,10 @@ PidFile "$fqgitdir/pid"
321
Listen $bind$port
322
EOF
323
317
- for mod in mime dir env log_config; do
318
- if test -e $module_path/mod_${mod}.so; then
324
+ for mod in mime dir env log_config
325
+ do
326
+ if test -e $module_path/mod_${mod}.so
327
+ then
328
echo "LoadModule ${mod}_module " \
329
"$module_path/mod_${mod}.so" >> "$conf"
330
fi
@@ -563,7 +572,7 @@ case "$httpd" in
572
*lighttpd*)
573
lighttpd_conf
574
;;
566
-*apache2*)
575
+*apache2*|*httpd*)
576
apache2_conf
577
;;
578
webrick)