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
|
#! /bin/sh
#
# postinst script for jwchat
#
set -e
configfile='/etc/jwchat/config.js'
configsource='/usr/share/jwchat/config.js'
apachefile='/etc/apache2/sites-available/jwchat'
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 nobody:nogroup {} \;
}
setup_apache()
{
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
chown www-data: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
a2enmod proxy
a2enmod proxy_http
a2ensite jwchat
invoke-rc.d apache2 force-reload
fi
}
case $1 in
configure|reconfigure)
fixperms
setup_apache
rm -f $tempfile
exit 0
;;
*)
echo "postinst called with unknown argument \`$1'" 1>&2
exit 1
;;
esac
#DEBHELPER#
|