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
|
#! /bin/sh
# postinst script for b2evolution
#
# see: dh_installdeb(1)
# 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
set -e
B2EVO_PATH=/usr/share/b2evolution
B2EVO_CONF=/etc/b2evolution/_config.php
OLDVERSION=$2
# source debconf stuff
. /usr/share/debconf/confmodule
baseurl_change() {
sed -i "s/^\$baseurl.*;/\$baseurl\ \=\ \'$BASE_URL_PROTECTED\';/" $B2EVO_CONF
sed -i "s/^\$admin_email.*;/\$admin_email\ \=\ \'postmaster@$DOMAIN\';/" $B2EVO_CONF
}
case "$1" in
configure)
if [ -z "$OLDVERSION" ]; then
db_get b2evolution/db_ask || true
if [ "$RET" = "true" ]; then
db_get b2evolution/db_name || true
DB_NAME="$RET"
db_get b2evolution/host || true
URL="$RET"
BASE_URL=`echo $URL | sed 's/[\/]*$//'`
DOMAIN=`echo $BASE_URL | cut -d "/" -f 3`
sh $B2EVO_PATH/extras/setup-config $DOMAIN $BASE_URL $DB_NAME
fi
if [ "$RET" = "false" ]; then
DB_NAME="b2evolution"
db_get b2evolution/host || true
URL="$RET"
BASE_URL=`echo $URL | sed 's/[\/]*$//'`
DOMAIN=`echo $BASE_URL | cut -d "/" -f 3`
fi
fi
if [ ! -z "$OLDVERSION" ]; then
db_get b2evolution/host || true
URL="$RET"
BASE_URL=`echo "$URL" | sed 's/[\/]*$//'`
BASE_URL_PROTECTED=`echo $BASE_URL | sed 's/\//\\\\\//g'`
DOMAIN=`echo "$BASE_URL_PROTECTED" | cut -d '/' -f 3 | sed 's/[\\]*$//'`
baseurl_change
fi
chown root:www-data /etc/b2evolution/_config.php*
chmod 640 /etc/b2evolution/_config.php*
;;
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
|