-
Notifications
You must be signed in to change notification settings - Fork 3
/
cli
executable file
·68 lines (61 loc) · 1.96 KB
/
cli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /bin/sh
## Eregansu command-line script
## In an instance which has previously been configured, this script is
## just invoked as ./cli
##
## Otherwise, on a newly-minted instance, this script can be invoked
## from the eregansu platform tree. e.g.:
##
## cd /www/docs/demo && /opt/packages/eregansu/cli
##
## If no index.php is located in the instance directory, this script
## automatically invokes eregansu/index.install.php to execute the first-run
## process.
## Environment variables:
##
## PHP_5 (defaults to 'php') The name or path to the PHP interpreter
## EREGANSU_PAUSE_ON_EXIT If non-empty, don't terminate the script
## immediately after the instance has been
## finished executing the commands.
if test x"${PHP_5}" = x"" ; then
PHP_5="php"
fi
platform=`dirname "$0"`
root="$platform"
here=`pwd`
if test -d "$dir/eregansu" && test -f "$dir/eregansu/platform.php" ; then
platform=`cd "$dir/eregansu" && pwd`
elif test -d ./eregansu ; then
platform=`cd "./eregansu" && pwd`
elif test -d "$dir/platform" && test -f "$dir/platform/platform.php" ; then
platform=`cd "$dir/platform" && pwd`
elif test -d ./platform ; then
platform=`cd ./platform && pwd`
fi
cd "$here"
php_script=''
if test -r "$root/public/index.php" ; then
php_script="$root/public/index.php"
elif test -r "$root/index.php" ; then
php_script="$root/public/index.php"
elif test -r public/index.php ; then
php_script="public/index.php"
elif test -r index.php ; then
php_script="index.php"
else
if test -r "$platform/index.install.php" ; then
echo ">>> index.php does not exist, running 'cli insall'" >&2
exec ${PHP_5} -f "$platform/index.install.php"
fi
echo "$0: cannot find index.php or $dir/index.install.php" >&2
exit 1
fi
if test x"$EREGANSU_PAUSE_ON_EXIT" = x"" ; then
exec ${PHP_5} -f "$php_script" "$@"
else
${PHP_5} -f "$php_script" "$@"
status=$?
echo "*** Subprocess exited with status $status" >&2
read dummy
exit $status
fi