Skip to content

Commit 0d34473

Browse files
Tarmigan Caseboltgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Tarmigan Casebolt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 902f235 commit 0d34473

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

t/lib-httpd.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,29 @@ fi
1212

1313
HTTPD_PARA=""
1414

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+
1534
case $(uname) in
1635
Darwin)
17-
DEFAULT_HTTPD_PATH='/usr/sbin/httpd'
18-
DEFAULT_HTTPD_MODULE_PATH='/usr/libexec/apache2'
1936
HTTPD_PARA="$HTTPD_PARA -DDarwin"
2037
;;
21-
*)
22-
DEFAULT_HTTPD_PATH='/usr/sbin/apache2'
23-
DEFAULT_HTTPD_MODULE_PATH='/usr/lib/apache2/modules'
24-
;;
2538
esac
2639

2740
LIB_HTTPD_PATH=${LIB_HTTPD_PATH-"$DEFAULT_HTTPD_PATH"}
@@ -49,6 +62,11 @@ then
4962
say "skipping test, at least Apache version 2 is required"
5063
test_done
5164
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
5270

5371
LIB_HTTPD_MODULE_PATH="$DEFAULT_HTTPD_MODULE_PATH"
5472
fi

0 commit comments

Comments
 (0)