libreccm-legacy/ccm-forum/debian/postinst

113 lines
3.2 KiB
Bash
Executable File

#! /bin/sh
# postinst script for ccm-forum
#
# see: dh_installdeb(1)
#
# Author: Berkan Eskikaya <berkan@runtime-collective.com>, 2004
#
# $Id: postinst,v 1.1.1.1 2004/11/12 09:30:12 fabrice Exp $
set -e
. /usr/share/debconf/confmodule
. /usr/share/ccm-tools/lib/shellmodule
# 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>
# * <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
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
case "$1" in
configure|reconfigure)
# FIXME: we need to be sensitive to upgrade operations here.
# basically, if pkgversion = appversion, then the datamodel
# hasn't changed -- we just configure the package and don't
# touch the database; else, we need to also update the
# datamodel in the database.
### get the settings for the operations below
ccm_set_env
db_get_ccm_settings ;# db_stop
get_pkgname_from_arg "$0"
ccm_package_name="$RET"
get_pkgversion_from_dpkg "$ccm_package_name"
ccm_package_version="$RET"
### do the usual post-installion configuration
if [ ! -d "/etc/ccm" ]; then
db_message "ccm/shared/error_etc_ccm_missing_dir"
mkdir -p "/etc/ccm"
fi
ccm_update_ccm_classpath add $ccm_package_name $ccm_package_version
ccm_update_ccm_webapps add $ccm_package_name $ccm_package_version
ccm_update_file_attributes $ccm_package_name $ccm_package_version
### try to set up the database if asked to do so
if [ "$pg_set_up_database_p" = "true" ]; then
pg_set_up_database
fi
### try to load the application if asked to do so
if [ "$ccm_load_apps_at_install_p" = "true" -a -n "$JAVA_HOME" ]; then
ccm_load
fi
### run the hostinit step
if [ -n "$JAVA_HOME" ]; then
tomcat_http_port=`echo $waf_web_server | cut -d':' -f2` || true
tomcat_shutdown_port=`expr $tomcat_http_port + 1` || true
ccm_host_init tomcat $tomcat_http_port $tomcat_shutdown_port
fi
### don't give others the registry details [eg the database password] on a golden plate
# FIXME: this interferes with "ccm load" updating the registry. Need to find the right ownership.
# chmod -R o-rwx /etc/ccm/conf/registry || true
;;
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.
#DEBHELPER#
exit 0