summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert@lshift.net>2009-06-10 14:23:00 +0100
committerHubert Plociniczak <hubert@lshift.net>2009-06-10 14:23:00 +0100
commit77eb7ad7c6daa1313d26e84e801bb8c5170dd78c (patch)
treee17a7ee3b59473d015bba8f08cef1721aa3dd742
parentc807a4f6642b10c7d2f57f58b1502706d538eafa (diff)
parent5124295175d7ef18fff5c48b39d62e290b2dea41 (diff)
downloadrabbitmq-server-77eb7ad7c6daa1313d26e84e801bb8c5170dd78c.tar.gz
Merge two default branches into one.
-rw-r--r--packaging/macports/net/rabbitmq-server/Portfile48
-rw-r--r--packaging/macports/net/rabbitmq-server/files/rabbitmq-script-wrapper23
-rw-r--r--packaging/macports/net/rabbitmq-server/files/rabbitmqctl_wrapper2
3 files changed, 50 insertions, 23 deletions
diff --git a/packaging/macports/net/rabbitmq-server/Portfile b/packaging/macports/net/rabbitmq-server/Portfile
index 65913256..805bc3fd 100644
--- a/packaging/macports/net/rabbitmq-server/Portfile
+++ b/packaging/macports/net/rabbitmq-server/Portfile
@@ -32,6 +32,8 @@ set serverhome ${prefix}/var/lib/rabbitmq
set logdir ${prefix}/var/log/rabbitmq
set mnesiadbdir ${prefix}/var/lib/rabbitmq/mnesia
set plistloc ${prefix}/etc/LaunchDaemons/org.macports.rabbitmq-server
+set sbindir ${destroot}${prefix}/lib/rabbitmq/bin
+set wrappersbin ${destroot}${prefix}/sbin
use_configure no
@@ -41,7 +43,7 @@ build.args PYTHON=${prefix}/bin/python2.5
destroot.destdir \
TARGET_DIR=${destroot}${prefix}/lib/erlang/lib/rabbitmq_server-${version} \
- SBIN_DIR=${destroot}${prefix}/sbin \
+ SBIN_DIR=${sbindir} \
MAN_DIR=${destroot}${prefix}/share/man
destroot.keepdirs \
@@ -59,32 +61,36 @@ post-destroot {
xinstall -d -g [existsgroup ${servergroup}] -m 775 ${destroot}${mnesiadbdir}
reinplace -E "s:(/etc/rabbitmq/rabbitmq.conf):${prefix}\\1:g" \
- ${destroot}${prefix}/sbin/rabbitmq-multi \
- ${destroot}${prefix}/sbin/rabbitmq-server \
- ${destroot}${prefix}/sbin/rabbitmqctl
+ ${sbindir}/rabbitmq-multi \
+ ${sbindir}/rabbitmq-server \
+ ${sbindir}/rabbitmqctl
reinplace -E "s:(RABBITMQ_CLUSTER_CONFIG_FILE)=/:\\1=${prefix}/:" \
- ${destroot}${prefix}/sbin/rabbitmq-multi \
- ${destroot}${prefix}/sbin/rabbitmq-server \
- ${destroot}${prefix}/sbin/rabbitmqctl
+ ${sbindir}/rabbitmq-multi \
+ ${sbindir}/rabbitmq-server \
+ ${sbindir}/rabbitmqctl
reinplace -E "s:(RABBITMQ_LOG_BASE)=/:\\1=${prefix}/:" \
- ${destroot}${prefix}/sbin/rabbitmq-multi \
- ${destroot}${prefix}/sbin/rabbitmq-server \
- ${destroot}${prefix}/sbin/rabbitmqctl
+ ${sbindir}/rabbitmq-multi \
+ ${sbindir}/rabbitmq-server \
+ ${sbindir}/rabbitmqctl
reinplace -E "s:(RABBITMQ_MNESIA_BASE)=/:\\1=${prefix}/:" \
- ${destroot}${prefix}/sbin/rabbitmq-multi \
- ${destroot}${prefix}/sbin/rabbitmq-server \
- ${destroot}${prefix}/sbin/rabbitmqctl
+ ${sbindir}/rabbitmq-multi \
+ ${sbindir}/rabbitmq-server \
+ ${sbindir}/rabbitmqctl
reinplace -E "s:(RABBITMQ_PIDS_FILE)=/:\\1=${prefix}/:" \
- ${destroot}${prefix}/sbin/rabbitmq-multi \
- ${destroot}${prefix}/sbin/rabbitmq-server \
- ${destroot}${prefix}/sbin/rabbitmqctl
+ ${sbindir}/rabbitmq-multi \
+ ${sbindir}/rabbitmq-server \
+ ${sbindir}/rabbitmqctl
- file rename ${destroot}${prefix}/sbin/rabbitmqctl ${destroot}${prefix}/sbin/rabbitmqctl_real
- xinstall -m 555 ${filespath}/rabbitmqctl_wrapper ${destroot}${prefix}/sbin
- file rename ${destroot}${prefix}/sbin/rabbitmqctl_wrapper ${destroot}${prefix}/sbin/rabbitmqctl
+ xinstall -m 555 ${filespath}/rabbitmq-script-wrapper \
+ ${wrappersbin}/rabbitmq-multi
+
+ reinplace -E "s:/usr/lib/rabbitmq/bin/:${prefix}/lib/rabbitmq/bin/:" \
+ ${wrappersbin}/rabbitmq-multi
+ reinplace -E "s:/var/lib/rabbitmq:${prefix}/var/lib/rabbitmq:" \
+ ${wrappersbin}/rabbitmq-multi
+ file copy ${wrappersbin}/rabbitmq-multi ${wrappersbin}/rabbitmq-server
+ file copy ${wrappersbin}/rabbitmq-multi ${wrappersbin}/rabbitmqctl
- reinplace -E "s:@PREFIX@:${prefix}:" \
- ${destroot}${prefix}/sbin/rabbitmqctl
}
pre-install {
diff --git a/packaging/macports/net/rabbitmq-server/files/rabbitmq-script-wrapper b/packaging/macports/net/rabbitmq-server/files/rabbitmq-script-wrapper
new file mode 100644
index 00000000..296a77d1
--- /dev/null
+++ b/packaging/macports/net/rabbitmq-server/files/rabbitmq-script-wrapper
@@ -0,0 +1,23 @@
+#!/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 /var/lib/rabbitmq
+
+SCRIPT=`basename $0`
+
+if [ `id -u` = 0 ] ; then
+ su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}"
+else
+ /usr/lib/rabbitmq/bin/${SCRIPT}
+ echo -e "\nOnly root should run ${SCRIPT}\n"
+ exit 1
+fi
+
diff --git a/packaging/macports/net/rabbitmq-server/files/rabbitmqctl_wrapper b/packaging/macports/net/rabbitmq-server/files/rabbitmqctl_wrapper
deleted file mode 100644
index 1996811e..00000000
--- a/packaging/macports/net/rabbitmq-server/files/rabbitmqctl_wrapper
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-exec sudo -H -u rabbitmq "@PREFIX@/sbin/rabbitmqctl_real" "$@"