Fix gerrit.sh to run properly on SuSE systems
Minor typo on the test, we need to use -a and not && to perform multiple compare operations in one test invocation. We can't use " & ;" in Bourne shell, the ; is unexpected. Allow START_STOP_DAEMON and NO_START to be inherited in from the environment, but also pulled from /etc/default/gerritcodereview if the administrator wants to override it. Change-Id: I8658b5ebcd6fad7bc008362e941f89e4b2b363aa Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -29,9 +29,10 @@
|
||||
#
|
||||
# NO_START
|
||||
# If set to "1" disables Gerrit from starting.
|
||||
|
||||
# Set to 0 if you do not want to use start-stop-daemon (especially on SUSE boxes)
|
||||
START_STOP_DAEMON=1
|
||||
#
|
||||
# START_STOP_DAEMON
|
||||
# If set to "0" disables using start-stop-daemon. This may need to
|
||||
# be set on SuSE systems.
|
||||
|
||||
usage() {
|
||||
me=`basename "$0"`
|
||||
@@ -137,7 +138,8 @@ while test $# -gt 0 ; do
|
||||
esac
|
||||
done
|
||||
|
||||
NO_START=0
|
||||
test -z "$NO_START" && NO_START=0
|
||||
test -z "$START_STOP_DAEMON" && START_STOP_DAEMON=1
|
||||
|
||||
##################################################
|
||||
# See if there's a default configuration file
|
||||
@@ -383,11 +385,11 @@ case "$ACTION" in
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $UID = 0 && -n "$GERRIT_USER" ; then
|
||||
if test $UID = 0 -a -n "$GERRIT_USER" ; then
|
||||
touch "$GERRIT_PID"
|
||||
chown $GERRIT_USER "$GERRIT_PID"
|
||||
su - $GERRIT_USER -c "
|
||||
$RUN_EXEC $RUN_Arg1 '$RUN_Arg2' $RUN_Arg3 $RUN_ARGS & ;
|
||||
$RUN_EXEC $RUN_Arg1 '$RUN_Arg2' $RUN_Arg3 $RUN_ARGS &
|
||||
PID=\$! ;
|
||||
disown \$PID ;
|
||||
echo \$PID >\"$GERRIT_PID\""
|
||||
|
||||
Reference in New Issue
Block a user