diff options
author | Hubert Plociniczak <hubert@lshift.net> | 2009-02-04 01:02:39 +0000 |
---|---|---|
committer | Hubert Plociniczak <hubert@lshift.net> | 2009-02-04 01:02:39 +0000 |
commit | 379e9b437720d352ae3171aaa8e2b338bdcd4e46 (patch) | |
tree | 0b6e793eb7d3b0a7a118682ba4cc1f9adb6376f7 /packaging/debs | |
parent | ce3787ff42a492406b681c52eddc89e588f1111d (diff) | |
download | rabbitmq-server-379e9b437720d352ae3171aaa8e2b338bdcd4e46.tar.gz |
Provide common wrapper script that is used by all commands and requires root permissions to function normally.
Also added PATH variable in init.d and use new wrappers.
Diffstat (limited to 'packaging/debs')
-rw-r--r-- | packaging/debs/Debian/Makefile | 2 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/init.d | 13 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/rabbitmqctl_wrapper | 21 | ||||
-rw-r--r-- | packaging/debs/Debian/debian/rules | 5 |
4 files changed, 12 insertions, 29 deletions
diff --git a/packaging/debs/Debian/Makefile b/packaging/debs/Debian/Makefile index 9479feb0..67fabae0 100644 --- a/packaging/debs/Debian/Makefile +++ b/packaging/debs/Debian/Makefile @@ -1,5 +1,6 @@ TARBALL_DIR=../../../dist TARBALL=$(shell (cd $(TARBALL_DIR); echo rabbitmq-server-[0-9]*.tar.gz)) +COMMON_DIR=../../common DEBIAN_ORIG_TARBALL=$(shell echo $(TARBALL) | sed -e 's:\(.*\)-\(.*\)\(\.tar\.gz\):\1_\2\.orig\3:g') VERSION=$(shell echo $(TARBALL) | sed -e 's:rabbitmq-server-\(.*\)\.tar\.gz:\1:g') UNPACKED_DIR=rabbitmq-server-$(VERSION) @@ -19,6 +20,7 @@ package: clean cp $(TARBALL_DIR)/$(TARBALL) $(DEBIAN_ORIG_TARBALL) tar -zxvf $(DEBIAN_ORIG_TARBALL) cp -r debian $(UNPACKED_DIR) + cp $(COMMON_DIR)/* $(UNPACKED_DIR)/debian/ chmod a+x $(UNPACKED_DIR)/debian/rules UNOFFICIAL_RELEASE=$(UNOFFICIAL_RELEASE) VERSION=$(VERSION) ./check-changelog.sh rabbitmq-server $(UNPACKED_DIR) cd $(UNPACKED_DIR); GNUPGHOME=$(GNUPG_PATH)/.gnupg dpkg-buildpackage -rfakeroot $(SIGNING) diff --git a/packaging/debs/Debian/debian/init.d b/packaging/debs/Debian/debian/init.d index 70dd0adf..e9942b2a 100644 --- a/packaging/debs/Debian/debian/init.d +++ b/packaging/debs/Debian/debian/init.d @@ -9,7 +9,8 @@ # Short-Description: Enable AMQP service provided by RabbitMQ broker ### END INIT INFO -DAEMON=/usr/lib/rabbitmq/bin/rabbitmq-multi +PATH=/usr/sbin:/usr/bin:/sbin:/bin +DAEMON=/usr/sbin/rabbitmq-multi NAME=rabbitmq-server DESC=rabbitmq-server USER=rabbitmq @@ -29,7 +30,7 @@ cd / start_rabbitmq () { set +e - su $USER -s /bin/sh -c "$DAEMON start_all ${NODE_COUNT}" > /var/log/rabbitmq/startup_log 2> /var/log/rabbitmq/startup_err + $DAEMON start_all ${NODE_COUNT} > /var/log/rabbitmq/startup_log 2> /var/log/rabbitmq/startup_err case "$?" in 0) echo SUCCESS @@ -51,7 +52,7 @@ stop_rabbitmq () { set +e status_rabbitmq quiet if [ $RETVAL = 0 ] ; then - su $USER -s /bin/sh -c "$DAEMON stop_all" > /var/log/rabbitmq/shutdown_log 2> /var/log/rabbitmq/shutdown_err + $DAEMON stop_all > /var/log/rabbitmq/shutdown_log 2> /var/log/rabbitmq/shutdown_err RETVAL=$? if [ $RETVAL != 0 ] ; then echo FAILED - check /var/log/rabbitmq/shutdown_log, _err @@ -66,9 +67,9 @@ stop_rabbitmq () { status_rabbitmq() { set +e if [ "$1" != "quiet" ] ; then - su $USER -s /bin/sh -c "$DAEMON status" 2>&1 + $DAEMON status 2>&1 else - su $USER -s /bin/sh -c "$DAEMON status" > /dev/null 2>&1 + $DAEMON status > /dev/null 2>&1 fi if [ $? != 0 ] ; then RETVAL=1 @@ -78,7 +79,7 @@ status_rabbitmq() { rotate_logs_rabbitmq() { set +e - su $USER -s /bin/sh -c "$DAEMON rotate_logs ${ROTATE_SUFFIX}" 2>&1 + $DAEMON rotate_logs ${ROTATE_SUFFIX} 2>&1 set -e } diff --git a/packaging/debs/Debian/debian/rabbitmqctl_wrapper b/packaging/debs/Debian/debian/rabbitmqctl_wrapper deleted file mode 100644 index d53a6ca9..00000000 --- a/packaging/debs/Debian/debian/rabbitmqctl_wrapper +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# Escape spaces and quotes, because shell is revolting. -for arg in "$@" ; do - # Escape quotes in parameters, so that they're passed through cleanly. - arg=$(sed -e 's/"/\\"/' <<-END - $arg - END - ) - CMDLINE="${CMDLINE} \"${arg}\"" -done - -cd / - -if [ `id -u` = 0 ] ; then - su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/rabbitmqctl ${CMDLINE}" -else - /usr/lib/rabbitmq/bin/rabbitmqctl - echo -e "\nOnly root should run rabbitmqctl\n" - exit 1 -fi - diff --git a/packaging/debs/Debian/debian/rules b/packaging/debs/Debian/debian/rules index 908ec481..31904851 100644 --- a/packaging/debs/Debian/debian/rules +++ b/packaging/debs/Debian/debian/rules @@ -14,5 +14,6 @@ DOCDIR=$(DEB_DESTDIR)usr/share/doc/rabbitmq-server/ install/rabbitmq-server:: mkdir -p $(DOCDIR) rm $(RABBIT_LIB)LICENSE* - cp debian/rabbitmqctl_wrapper $(DEB_DESTDIR)usr/sbin/rabbitmqctl - chmod a+x $(DEB_DESTDIR)usr/sbin/rabbitmqctl + for script in rabbitmqctl rabbitmq-server rabbitmq-multi; do \ + install -p -D -m 0755 debian/rabbitmq-script-wrapper $(DEB_DESTDIR)usr/sbin/$$script; \ + done |