| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# License: GNU General Public License (GPL) |
| 4 |
# |
| 5 |
# postinst script for heartbeat |
| 6 |
# |
| 7 |
# see: dh_installdeb(1) |
| 8 |
|
| 9 |
set -e |
| 10 |
|
| 11 |
# summary of how this script can be called: |
| 12 |
# * <postinst> `configure' <most-recently-configured-version> |
| 13 |
# * <old-postinst> `abort-upgrade' <new version> |
| 14 |
# * <conflictor's-postinst> `abort-remove' `in-favour' <package> |
| 15 |
# <new-version> |
| 16 |
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' |
| 17 |
# <failed-install-package> <version> `removing' |
| 18 |
# <conflicting-package> <version> |
| 19 |
# |
| 20 |
|
| 21 |
case "$1" in |
| 22 |
configure) |
| 23 |
if ! getent group haclient > /dev/null ; then |
| 24 |
addgroup --system --group haclient > /dev/null |
| 25 |
fi |
| 26 |
if ! getent passwd hacluster > /dev/null ; then |
| 27 |
adduser --system --no-create-home \ |
| 28 |
--ingroup haclient \ |
| 29 |
--gecos "Heartbeat System Account" \ |
| 30 |
--no-create-home --disabled-login \ |
| 31 |
--home /usr/lib/heartbeat --shell /bin/false \ |
| 32 |
--disabled-password hacluster > /dev/null |
| 33 |
fi |
| 34 |
|
| 35 |
for i in /var/lib/heartbeat/ccm /var/lib/heartbeat/crm \ |
| 36 |
/var/lib/heartbeat/pengine; do |
| 37 |
mkdir -p $i |
| 38 |
chmod 750 $i |
| 39 |
chown hacluster $i |
| 40 |
chgrp haclient $i |
| 41 |
done |
| 42 |
|
| 43 |
chgrp haclient /usr/bin/cl_status |
| 44 |
chmod 2555 /usr/bin/cl_status |
| 45 |
|
| 46 |
for i in root nobody hacluster; do |
| 47 |
chmod 700 /var/lib/heartbeat/cores/$i |
| 48 |
chown $i /var/lib/heartbeat/cores/$i |
| 49 |
chgrp root /var/lib/heartbeat/cores/$i |
| 50 |
done |
| 51 |
|
| 52 |
# Do we want to move the old S20 symlinks to S75 ones? |
| 53 |
if [ -n "$2" ] ; then |
| 54 |
if `dpkg --compare-versions "$2" lt 1.0.4-2`; then |
| 55 |
# use debconf |
| 56 |
. /usr/share/debconf/confmodule |
| 57 |
db_get heartbeat/change_init || RET="false" |
| 58 |
if [ "$RET" = "true" ]; then |
| 59 |
update-rc.d -f heartbeat remove > /dev/null |
| 60 |
fi |
| 61 |
db_stop |
| 62 |
fi |
| 63 |
fi |
| 64 |
update-rc.d heartbeat start 75 2 3 4 5 . stop 05 0 1 6 . >/dev/null || true |
| 65 |
|
| 66 |
if which invoke-rc.d >/dev/null 2>&1; then |
| 67 |
invoke-rc.d heartbeat start || true |
| 68 |
else |
| 69 |
/etc/init.d/heartbeat start || true |
| 70 |
fi |
| 71 |
;; |
| 72 |
|
| 73 |
abort-upgrade|abort-remove|abort-deconfigure) |
| 74 |
# restart heartbeat |
| 75 |
if which invoke-rc.d >/dev/null 2>&1; then |
| 76 |
invoke-rc.d heartbeat start || true |
| 77 |
else |
| 78 |
/etc/init.d/heartbeat start || true |
| 79 |
fi |
| 80 |
;; |
| 81 |
|
| 82 |
*) |
| 83 |
echo "postinst called with unknown argument \`$1'" >&2 |
| 84 |
exit 0 |
| 85 |
;; |
| 86 |
esac |
| 87 |
|
| 88 |
# dh_installdeb will replace this with shell code automatically |
| 89 |
# generated by other debhelper scripts. |
| 90 |
|
| 91 |
#DEBHELPER# |
| 92 |
|
| 93 |
exit 0 |