summaryrefslogtreecommitdiff
path: root/scripts/rabbitmq-script-wrapper
diff options
context:
space:
mode:
authorLuke Bakken <lbakken@pivotal.io>2017-09-08 17:41:10 -0700
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2017-09-20 11:31:59 +0200
commitf41036967299e43bc94ccfdf3ca097f898f4a4d8 (patch)
treea3b29d040adc5ad0fe950c6c7589c1cb34ff4b96 /scripts/rabbitmq-script-wrapper
parent617d1603d697b0f01660ef7a3fbd30e51ed3ea18 (diff)
downloadrabbitmq-server-git-f41036967299e43bc94ccfdf3ca097f898f4a4d8.tar.gz
Detect util-linux version of runuser
Alternative is to always use runuser invocation in else clause. Fixes #44. [#150221349]
Diffstat (limited to 'scripts/rabbitmq-script-wrapper')
-rw-r--r--scripts/rabbitmq-script-wrapper13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/rabbitmq-script-wrapper b/scripts/rabbitmq-script-wrapper
index 8a9d5f0e1d..dd8ce1a590 100644
--- a/scripts/rabbitmq-script-wrapper
+++ b/scripts/rabbitmq-script-wrapper
@@ -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" "$@"