Skip to content

Commit e14f991

Browse files
committed
Let entrypoint commands execute prerequisities automatically if necessary
1 parent 818a90e commit e14f991

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

docker/php-src-devtools-entrypoint

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,39 @@
11
#!/usr/bin/env bash
22
set -e
33

4+
function doConfigure()
5+
{
6+
if [ ! -f configure ]; then
7+
./buildconf
8+
fi
9+
./configure
10+
}
11+
12+
function doBuild()
13+
{
14+
if [ ! -f Makefile ]; then
15+
doConfigure
16+
fi;
17+
make -j`nproc`
18+
}
19+
20+
function doTest()
21+
{
22+
if [ ! -f Makefile ]; then
23+
doConfigure
24+
fi;
25+
TESTS="$1" make -j`nproc` test
26+
}
27+
428
case "$1" in
529
"build")
6-
make -j`nproc`
7-
;;
8-
"buildconf")
9-
./buildconf
30+
doBuild
1031
;;
1132
"configure")
12-
./configure
33+
doConfigure
1334
;;
1435
"test")
15-
TESTS="$2" make test
36+
doTest "$1"
1637
;;
1738
*)
1839
echo "Unknown command"

0 commit comments

Comments
 (0)