b0cc0ccb14
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
49 lines
1.3 KiB
Bash
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
|