]> review.fuel-infra Code Review - packages/trusty/mcollective.git/blob - debian/mcollective.postinst
Update mcollective to 2.3.3 for MOS 6.1
[packages/trusty/mcollective.git] / debian / mcollective.postinst
1 #!/bin/sh
2
3 set -e
4
5 if [  "$1" = "triggered" ]; then
6         invoke-rc.d mcollective stop || :
7         invoke-rc.d mcollective start
8         exit
9 fi
10
11 MCOLLECTIVE_SERVER_CFG="/etc/mcollective/server.cfg"
12
13 case "$1" in
14         configure)
15                 if [ ! -e "$MCOLLECTIVE_SERVER_CFG" ]; then
16                         cp /usr/share/mcollective/server.cfg $MCOLLECTIVE_SERVER_CFG
17                 else
18                         # try to update config file values
19                         # remove deprecated voncif goption
20                         sed -i 's/^topicprefix.*$//g' $MCOLLECTIVE_SERVER_CFG
21                         # change default connector. previous one "stomp" has been deprecated since 2.2.0
22                         sed -i 's/^connector = stomp/connector = activemq\nplugin.activemq.pool.size = 1/g' $MCOLLECTIVE_SERVER_CFG
23                         # change stomp options to activemq ones, keeping user values
24                         sed -i 's/^plugin.stomp.host=\(.*\)$/plugin.activemq.pool.1.host = \1/g' $MCOLLECTIVE_SERVER_CFG
25                         sed -i 's/^plugin.stomp.port=.*$/plugin.activemq.pool.1.port = 61613/g' $MCOLLECTIVE_SERVER_CFG
26                         sed -i 's/^plugin.stomp.user=\(.*\)$/plugin.activemq.pool.1.user = \1/g' $MCOLLECTIVE_SERVER_CFG
27                         sed -i 's/^plugin.stomp.password=\(.*\)/plugin.activemq.pool.1.password = \1/g' $MCOLLECTIVE_SERVER_CFG
28                 fi
29
30                 chmod 600 $MCOLLECTIVE_SERVER_CFG
31         ;;
32         abort-upgrade|abort-remove|abort-deconfigure)
33         ;;
34         *)
35                 echo "postinst called with unknown argument \`${1}'" >&2
36                 exit 1
37         ;;
38 esac
39
40 #DEBHELPER#
41
42 exit 0