]> asedeno.scripts.mit.edu Git - git.git/commitdiff
t/lib-http.sh: Restructure finding of default httpd location
authorTarmigan Casebolt <tarmigan+git@gmail.com>
Sat, 2 Jan 2010 22:04:25 +0000 (14:04 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Jan 2010 09:07:07 +0000 (01:07 -0800)
On CentOS 5, httpd is located at /usr/sbin/httpd, and the modules are
located at /usr/lib64/httpd/modules.  To enable easy testing of httpd,
we would like those locations to be detected automatically.

uname might not be the best way to determine the default location for
httpd since different Linux distributions apparently put httpd in
different places, so we test a couple different locations for httpd,
and use the first one that we come across.  We do the same for the
modules directory.

cc: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-httpd.sh

index 6765b08065e8959dcec38940188818b952d2fcd0..28aff887b5a92ec5919f4005010ef64f85d908e9 100644 (file)
@@ -12,16 +12,29 @@ fi
 
 HTTPD_PARA=""
 
+for DEFAULT_HTTPD_PATH in '/usr/sbin/httpd' '/usr/sbin/apache2'
+do
+       if test -x "$DEFAULT_HTTPD_PATH"
+       then
+               break
+       fi
+done
+
+for DEFAULT_HTTPD_MODULE_PATH in '/usr/libexec/apache2' \
+                                '/usr/lib/apache2/modules' \
+                                '/usr/lib64/httpd/modules' \
+                                '/usr/lib/httpd/modules'
+do
+       if test -d "$DEFAULT_HTTPD_MODULE_PATH"
+       then
+               break
+       fi
+done
+
 case $(uname) in
        Darwin)
-               DEFAULT_HTTPD_PATH='/usr/sbin/httpd'
-               DEFAULT_HTTPD_MODULE_PATH='/usr/libexec/apache2'
                HTTPD_PARA="$HTTPD_PARA -DDarwin"
        ;;
-       *)
-               DEFAULT_HTTPD_PATH='/usr/sbin/apache2'
-               DEFAULT_HTTPD_MODULE_PATH='/usr/lib/apache2/modules'
-       ;;
 esac
 
 LIB_HTTPD_PATH=${LIB_HTTPD_PATH-"$DEFAULT_HTTPD_PATH"}
@@ -49,6 +62,11 @@ then
                        say "skipping test, at least Apache version 2 is required"
                        test_done
                fi
+               if ! test -d "$DEFAULT_HTTPD_MODULE_PATH"
+               then
+                       say "Apache module directory not found.  Skipping tests."
+                       test_done
+               fi
 
                LIB_HTTPD_MODULE_PATH="$DEFAULT_HTTPD_MODULE_PATH"
        fi