@matheusbsbs / matheus-bagliano / commits / 0d344738dc
Fork 0

t/lib-http.sh: Restructure finding of default httpd location

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>

Tarmigan Casebolt committed Jan 2, 2010 at 14:04 UTC 0d344738dc55a75bddbcd9a08ea9a7b401f1aa63
1 file changed +24 -6
t/lib-httpd.sh
+24 -6
@@ -12,16 +12,29 @@ fi
12
13 HTTPD_PARA=""
14
15 +for DEFAULT_HTTPD_PATH in '/usr/sbin/httpd' '/usr/sbin/apache2'
16 +do
17 + if test -x "$DEFAULT_HTTPD_PATH"
18 + then
19 + break
20 + fi
21 +done
22 +
23 +for DEFAULT_HTTPD_MODULE_PATH in '/usr/libexec/apache2' \
24 + '/usr/lib/apache2/modules' \
25 + '/usr/lib64/httpd/modules' \
26 + '/usr/lib/httpd/modules'
27 +do
28 + if test -d "$DEFAULT_HTTPD_MODULE_PATH"
29 + then
30 + break
31 + fi
32 +done
33 +
34 case $(uname) in
35 Darwin)
17 - DEFAULT_HTTPD_PATH='/usr/sbin/httpd'
18 - DEFAULT_HTTPD_MODULE_PATH='/usr/libexec/apache2'
36 HTTPD_PARA="$HTTPD_PARA -DDarwin"
37 ;;
21 - *)
22 - DEFAULT_HTTPD_PATH='/usr/sbin/apache2'
23 - DEFAULT_HTTPD_MODULE_PATH='/usr/lib/apache2/modules'
24 - ;;
38 esac
39
40 LIB_HTTPD_PATH=${LIB_HTTPD_PATH-"$DEFAULT_HTTPD_PATH"}
@@ -49,6 +62,11 @@ then
62 say "skipping test, at least Apache version 2 is required"
63 test_done
64 fi
65 + if ! test -d "$DEFAULT_HTTPD_MODULE_PATH"
66 + then
67 + say "Apache module directory not found. Skipping tests."
68 + test_done
69 + fi
70
71 LIB_HTTPD_MODULE_PATH="$DEFAULT_HTTPD_MODULE_PATH"
72 fi