monasca-agent/packaging/monasca-agent-deb/postinst
Craig Bryant b0cc0ccb14 Change the default agent user to mon-agent
Changed some places to templates to make it possible to change agent
user using monasca_setup. There is one place that it is still
hard coded

The deb creation now uses a hardcoded mon-agent user instead of
monasca-agent

Change-Id: I8f2ee8903289d74c0397ccf911701c89e7a1b691
2015-05-06 11:41:28 -06:00

49 lines
1.3 KiB
Bash

#! /bin/bash
set -e
case "$1" in
configure)
AGENT_USER=mon-agent
update-rc.d monasca-agent defaults
adduser --system ${AGENT_USER} --disabled-login --shell /bin/sh --no-create-home --quiet
usermod -d /usr/share/monasca/agent monasca-agent
chown root:root /etc/init.d/monasca-agent
chown -R ${AGENT_USER}:root /etc/monasca/agent
chown -R ${AGENT_USER}:root /var/log/monasca/agent
chown -R root:root /usr/share/monasca/agent
chown -h root:root /usr/bin/monasca-statsd
chown -h root:root /usr/bin/monasca-collector
chown -h root:root /usr/bin/monasca-forwarder
set +e
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d monasca-agent restart
else
/etc/init.d/monasca-agent restart
fi
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
if [ $RETVAL -eq 3 ]; then
# No agent.yaml file is present. The user is probably following
# the step-by-step instructions and will add the config file next.
echo "No /etc/monasca/agent/agent.yaml found, exiting"
exit 0
else
exit $?
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
;;
esac
#DEBHELPER#
exit 0