~derek-name/openvista-gtm-integration/bug818588-ovbackup_nice

« back to all changes in this revision

Viewing changes to packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.postinst

  • Committer: Derek Veit
  • Date: 2011-08-22 19:04:10 UTC
  • mfrom: (131.2.576 replication)
  • Revision ID: derek.veit@medsphere.com-20110822190410-w4sepab2fxrs3u0p
Merge replication branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
 
1
#!/bin/bash
2
2
# postinst script for openvista-utils
3
3
#
4
4
# see: dh_installdeb(1)
55
55
                /etc/init.d/apache2 restart
56
56
            fi
57
57
        fi
 
58
 
 
59
        # add replication support to existing instances if upgrading
 
60
        if [ -n "$2" ] && dpkg --compare-versions "$2" lt 0.9-1; then
 
61
            echo "Adding replication support to existing instances..."
 
62
            . /usr/lib/openvista/functions
 
63
            for instname in $(list_openvista_instances); do
 
64
                # skip the instance if it has already been prepared for replication
 
65
                instance=$(get_ov_root)/${instname}
 
66
                if [ -e "${instance}/replication" ]; then
 
67
                    echo "Instance ${instname} already supports replication"
 
68
                    continue
 
69
                fi
 
70
 
 
71
                # create replication directory
 
72
                install -o root -g openvista -m 2770 -d "${instance}/replication"
 
73
 
 
74
                # create replication.conf
 
75
                /usr/sbin/ovgenconfig "${instname}" "replication.conf" \
 
76
                     "REPLICATION_MODE=" \
 
77
                     "REPLICATION_IP=" \
 
78
                     "BIND_ADDRESS=" \
 
79
                     "OTHER_INSTANCE=" \
 
80
                     "MUPIP_PORT=" \
 
81
                     "INSTSECONDARY=" \
 
82
                     "RSYNC_PORT="
 
83
 
 
84
                # generate the replication instance name
 
85
                random_suffix=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c4)
 
86
                gtm_repl_instname="${instname:0:8}_${random_suffix}"
 
87
 
 
88
                # create replication instance file
 
89
                gtm_dist=${instance}/gtm gtmgbldir=${instance}/globals/mumps.gld gtm_repl_instance=${instance}/replication/repl_instance "${instance}/gtm/mupip" replicate -instance_create -name="${gtm_repl_instname}" 2>&1 \
 
90
                  | logger -p user.info
 
91
                chmod 660 "${instance}/replication/repl_instance"
 
92
 
 
93
                echo "Support for replication added to ${instname}"
 
94
            done
 
95
 
 
96
        fi
 
97
 
 
98
        # on install or upgrade
 
99
        if dpkg --compare-versions "$2" lt 0.9-1; then
 
100
            ln -s /etc/rc.d/init.d/openvista /etc/openvista/primary.d/openvista
 
101
        fi
58
102
    ;;
59
103
 
60
104
    abort-upgrade|abort-remove|abort-deconfigure)