Determine GERRIT_SITE from current working directory.

If the start/stop script does not find the GERRIT_SITE variable it
will to try to determine the path via dirname calls on the $0
variable. If the script is not started with a full path name this will
end up as '.' and we will not be able to find the gerrit.config file.

If we end up in this situation we instead try to determine the
GERRIT_SITE from the current working directory.

Also a small spelling mistake is fixed.

Change-Id: Ieefb686ba07113bad7ca07cfd0de3aa427914d26
This commit is contained in:
Peter Jönsson
2012-09-11 18:47:14 +02:00
parent d768c7754d
commit b5ae7031cb

View File

@@ -126,7 +126,7 @@ TMPJ=$TMP/j$$
GERRIT_INSTALL_TRACE_FILE=etc/gerrit.config
##################################################
# No git in PATH? Needed for gerrit.confg parsing
# No git in PATH? Needed for gerrit.config parsing
##################################################
if type git >/dev/null 2>&1 ; then
: OK
@@ -140,7 +140,17 @@ fi
##################################################
if test -z "$GERRIT_SITE" ; then
GERRIT_SITE_1=`dirname "$0"`
##################################################
# As last resort assume we started the script from
# the bin directory of the Gerrit installation
##################################################
if [ "$GERRIT_SITE_1" = "." ]; then
GERRIT_SITE_1=`pwd`
fi
GERRIT_SITE_1=`dirname "$GERRIT_SITE_1"`
if test -f "${GERRIT_SITE_1}/${GERRIT_INSTALL_TRACE_FILE}" ; then
GERRIT_SITE=${GERRIT_SITE_1}
fi