Set a shell when launching Gerrit via the init script

gerrit.sh uses su to invoke gerrit as $GERRIT_USER without specifying a shell;
thus, if $GERRIT_USER's default shell is anything other than /bin/sh (or
something compatible like bash), in particular if it's /sbin/nologin or
/bin/false, the script would fail to launch gerrit. Explicitly setting a shell
when launching Gerrit fixes this.

Change-Id: I986ca438676d7cdec4437ddd286ba3af2ee39388
This commit is contained in:
Will Boyd
2013-01-23 11:53:05 -05:00
parent 0a3018492a
commit cb99d2e1ac

View File

@@ -403,7 +403,7 @@ case "$ACTION" in
if test $UID = 0 -a -n "$GERRIT_USER" ; then
touch "$GERRIT_PID"
chown $GERRIT_USER "$GERRIT_PID"
su - $GERRIT_USER -c "
su - $GERRIT_USER -s /bin/sh -c "
JAVA='$JAVA' ; export JAVA ;
$RUN_EXEC $RUN_Arg1 '$RUN_Arg2' $RUN_Arg3 $RUN_ARGS </dev/null >/dev/null 2>&1 &
PID=\$! ;