#!/bin/sh RABBITMQ_GID=%%RABBITMQ_GID%% RABBITMQ_GROUP=%%RABBITMQ_GROUP%% RABBITMQ_UID=%%RABBITMQ_UID%% RABBITMQ_USER=%%RABBITMQ_USER%% case $2 in PRE-INSTALL) if ! pw group show "${RABBITMQ_GROUP}" > /dev/null; then if pw groupadd ${RABBITMQ_GROUP} -g ${RABBITMQ_GID}; then echo "Added group \"${RABBITMQ_GROUP}\"." else echo "Adding group \"${RABBITMQ_GROUP}\" failed..." exit 1 fi fi if ! pw user show "${RABBITMQ_USER}" > /dev/null; then if pw useradd ${RABBITMQ_USER} -u ${RABBITMQ_UID} \ -g ${RABBITMQ_GROUP} -h - -d /var/db/rabbitmq \ -s /usr/sbin/nologin -c "RabbitMQ" then echo "Added user \"${RABBITMQ_USER}\"." else echo "Adding user \"${RABBITMQ_USER}\" failed..." exit 1 fi fi ;; POST-INSTALL) mkdir -p %%PREFIX%%/etc/rabbitmq mkdir -p /var/db/rabbitmq/mnesia mkdir -p /var/log/rabbitmq chown -R ${RABBITMQ_USER}:${RABBITMQ_GROUP} /var/db/rabbitmq chown -R ${RABBITMQ_USER}:${RABBITMQ_GROUP} /var/log/rabbitmq ;; esac