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
|
#! /bin/sh
#
# postinst script for jwchat
#
set -e
configfile='/etc/jwchat/config.js'
configsource='/usr/share/jwchat/config.js'
oldapachefile='/etc/apache2/sites-available/jwchat'
apachefile='/etc/apache2/sites-available/jwchat.conf'
apachesource='/usr/share/jwchat/apache.conf'
wwwdir='/usr/share/jwchat/www'
tempfile=$(mktemp)
. /usr/share/debconf/confmodule
# chown everything to nobody:nogroup to make suphp happy
fixperms()
{
find $wwwdir -type d -exec chmod 0755 {} \;
find $wwwdir -type f -exec chmod 0644 {} \;
find $wwwdir -type f -exec chown root:nogroup {} \;
}
setup_apache()
{
case "$1" in
configure)
if dpkg --compare-versions "$2" le "1.0+dfsg-1.1"; then
if [ -e $oldapachefile.dpkg-backup ] && [ ! -e $apachefile ] ; then
mv $oldapachefile.dpkg-backup $apachefile
fi
fi
esac
db_get jwchat/ApacheServerName
apache_server_name="$RET"
sed -e "s|__ApacheServerName__|$apache_server_name|g" $configsource > \
$tempfile
ucf --three-way --debconf-ok $tempfile $configfile
chmod 644 $configfile
chown root:www-data $configfile
if [ -x /usr/sbin/apache2 -a "$apache_server_name" != "none" ]; then
db_get jwchat/JabberAddress
jabber_address="$RET"
sed -e "s|__ApacheServerName__|$apache_server_name|g" \
-e "s|__JabberAddress__|$jabber_address|g" \
$apachesource > $tempfile
ucf --three-way --debconf-ok $tempfile $apachefile
db_stop
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enmod proxy
apache2_invoke enmod proxy_http
apache2_invoke ensite jwchat
fi
fi
}
case $1 in
configure|reconfigure)
fixperms
setup_apache $@
rm -f $tempfile
;;
*)
echo "postinst called with unknown argument \`$1'" 1>&2
exit 1
;;
esac
#DEBHELPER#
|