egroupware_official/debian/egroupware-core.postinst
2007-02-26 09:22:01 +00:00

96 lines
2.3 KiB
Bash

#! /bin/sh
set -e
webserver_soft_reload() {
if command -v invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d "$1" force-reload || :
else
[ -x /etc/init.d/"$1" ] && /etc/init.d/"$1" force-reload || :
fi
}
. /usr/share/debconf/confmodule
db_version 2.0
if [ "$1" = configure ]; then
mkdir -p /var/lib/egroupware/files/users
mkdir -p /var/lib/egroupware/files/groups
mkdir -p /var/lib/egroupware/files/db_backup
mkdir -p /var/lib/egroupware/sessions
mkdir -p /var/lib/egroupware/default/files
mkdir -p /var/lib/egroupware/default/backup
config="/var/lib/egroupware/header.inc.php"
touch $config
if [ ! -s $config ] ; then
template="/usr/share/egroupware/header.inc.php.template"
# Get configuration passwords.
db_get "egroupware/header/user"
header_user="$RET"
db_get "egroupware/header/password"
header_password="$RET"
# Build egroupware header manager configuration file.
perl -MDigest::MD5 -e "
\$header_user = '$header_user' ;
\$header_password = Digest::MD5::md5_hex('$header_password') ;
while (<>) {
s#{SERVER_ROOT}#/usr/share/egroupware# ;
s#{INCLUDE_ROOT}#/usr/share/egroupware# ;
s/{SETUP_ACL}// ;
s/{HEADER_ADMIN_USER}/\$header_user/ ;
s/{HEADER_ADMIN_PASSWORD}/\$header_password/ ;
s/{DOMAIN_SELECTBOX}/false/ ;
s/{DB_PERSISTENT}/false/ ;
s/{SESSIONS_TYPE}/db/ ;
s/{ENABLE_MCRYPT}/false/ ;
s/{MCRYPT_VERSION}/none/ ;
s/{MCRYPT_IV}/none/ ;
print ;
}
" < $template > $config
fi
chown -R www-data:www-data /var/lib/egroupware/
chmod 600 $config
# Get the web server type.
db_get "egroupware/webserver"
save_IFS=$IFS
IFS=','
for i in $RET; do
case $i in
*"Apache") webservers="$webservers apache" ;;
*"Apache SSL") webservers="$webservers apache-ssl" ;;
*"Apache Perl") webservers="$webservers apache-perl" ;;
*"Apache 2") webservers="$webservers apache2" ;;
esac
done
IFS=$save_IFS
# Set up web server and reload it.
for server in $webservers ; do
if [ -d /etc/$server/conf.d/ ]; then
ln -fs ../../egroupware/apache.conf /etc/$server/conf.d/egroupware
case $server in
apache2)
a2enmod actions >/dev/null
;;
esac
webserver_soft_reload $server
else
echo "web server \"$server\" not installed; ignoring"
fi
done
fi
#DEBHELPER#
db_stop