Detect util-linux version of runuser
Alternative is to always use runuser invocation in else clause. Fixes #44. [#150221349]
This commit is contained in:
parent
617d1603d6
commit
f410369672
|
|
@ -77,7 +77,18 @@ exec_script_as_rabbitmq() {
|
|||
exec_script_as_root() {
|
||||
if [ -x /sbin/runuser ]
|
||||
then
|
||||
exec /sbin/runuser -u rabbitmq -- "/usr/lib/rabbitmq/bin/$SCRIPT" "$@"
|
||||
# TODO:
|
||||
# At some point all of the RabbitMQ supported distributions will be using
|
||||
# the util-linux version of /sbin/runuser, as it has been removed from GNU
|
||||
# coreutils as of 2012. At that point the first clause of the following
|
||||
# if statement can become the only statement used and the if/then
|
||||
# removed
|
||||
if /sbin/runuser --version | grep -qF util-linux
|
||||
then
|
||||
exec /sbin/runuser -u rabbitmq -- "/usr/lib/rabbitmq/bin/$SCRIPT" "$@"
|
||||
else
|
||||
exec /sbin/runuser -s /bin/sh -- rabbitmq "/usr/lib/rabbitmq/bin/$SCRIPT" "$@"
|
||||
fi
|
||||
elif [ -x /bin/su ]
|
||||
then
|
||||
exec /bin/su -s /bin/sh rabbitmq -- "/usr/lib/rabbitmq/bin/$SCRIPT" "$@"
|
||||
|
|
|
|||
Loading…
Reference in New Issue