#!/bin/bash

install-packages qpidd qpid-tools qpid-client

function install_qpidd_upstart {
  cat > /etc/init/qpidd.conf << eof
start on runlevel [2345]
stop on runlevel [016]

respawn
respawn limit 2 5

script
  exec qpidd --config=/etc/qpid/qpidd.conf
end script
post-start exec sleep 1
eof
}

if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
    install_qpidd_upstart
fi
