postinst is in z-push-common 2.3.8-2ubuntu1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #!/bin/sh
# postinst script for z-push
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
reload() {
# Redirection of 3 is needed because Debconf uses it and it might
# be inherited by webserver. See bug #446324.
invoke-rc.d $1 reload 3>/dev/null || true
}
set_perms() {
USER=$1
GROUP=$2
MODE=$3
FILE=$4
if ! dpkg-statoverride --list $FILE > /dev/null 2>&1; then
chown $USER:$GROUP $FILE
chmod $MODE $FILE
fi
}
case "$1" in
configure)
# Find out which webservers we have.
webservers=
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
webservers="$webservers apache2"
fi
if which lighty-enable-mod >/dev/null 2>&1 ; then
webservers="$webservers lighttpd"
fi
if which nginx >/dev/null 2>&1 ; then
webservers="$webservers nginx"
fi
# If we have more than one webserver, ask the user which of them
# he wants to use for Z-push.
if [ "$(echo $webservers | wc -w)" -gt 1 ]; then
. /usr/share/debconf/confmodule
db_version 2.0
db_get z-push/reconfigure-webserver
webservers="$RET"
fi
for webserver in $webservers; do
webserver=${webserver%,}
case "$webserver" in
apache2)
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enconf z-push.conf || exit $?
apache2_invoke enconf z-push-autodiscover.conf || exit $?
fi
;;
lighttpd)
# We also need auth to protect setup.php
ret=0
lighty-enable-mod z-push auth || ret=$?
if [ $ret = 1 ]; then
exit 1
fi
reload $webserver
;;
nginx)
;;
esac
done
set_perms www-data www-data 700 /var/lib/z-push
set_perms www-data www-data 700 /var/log/z-push
if [ -f /var/lib/z-push/settings -o -f /var/lib/z-push/users ]; then
if ! z-push-admin -a fixstates >/dev/null 2>&1 ; then
echo "Error running command 'z-push-admin -a fixstates'" >&2
echo "Please fix the issue and run this command manually." >&2
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0
|