2014-12-09 19:01:27 +01:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
#export DEBCONF_DEBUG=developer
|
|
|
|
set -e
|
|
|
|
# das hier muss ganz oben stehen (man debconf-devel)
|
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
db_version 2.0
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$1" = configure -o "$1" = upgrade ]
|
|
|
|
then
|
|
|
|
mkdir -p /var/lib/egroupware/default/files
|
|
|
|
mkdir -p /var/lib/egroupware/default/backup
|
|
|
|
|
|
|
|
config="/var/lib/egroupware/header.inc.php"
|
|
|
|
template="/usr/share/egroupware/header.inc.php.template"
|
|
|
|
|
|
|
|
install_log="/root/egroupware-epl-install.log"
|
|
|
|
date >> $install_log
|
|
|
|
|
|
|
|
# If upgrading, $2 contains the release currently installed, otherwise it's empty
|
|
|
|
if [ "$2" ]
|
|
|
|
then
|
|
|
|
/usr/share/egroupware/doc/rpm-build/post_install.php 2>&1 | /usr/bin/tee -a $install_log
|
2017-11-16 20:26:11 +01:00
|
|
|
# fix ownership of files created during update
|
|
|
|
chown -R www-data /var/lib/egroupware
|
2018-06-09 10:05:44 +02:00
|
|
|
chmod 700 /var/lib/egroupware/
|
2014-12-09 19:01:27 +01:00
|
|
|
else
|
2017-11-17 10:35:56 +01:00
|
|
|
apache_conf=apache.conf
|
2017-11-13 17:41:08 +01:00
|
|
|
# Debian 9 has no more /etc/lsb-release and gives an error
|
|
|
|
if test -f /etc/lsb-release && grep -q '^DISTRIB_ID="*Univention"*$' /etc/lsb-release
|
2014-12-09 19:01:27 +01:00
|
|
|
then
|
2017-11-17 10:35:56 +01:00
|
|
|
apache_conf=apache-univention.conf
|
2018-10-10 10:46:42 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$DOCKER_HOST_NAME" -a -n "$DB_HOST" ]
|
|
|
|
then
|
|
|
|
# docker UCS setup, use appcenter join script
|
|
|
|
:
|
|
|
|
else
|
|
|
|
if test -f /etc/lsb-release && grep -q '^DISTRIB_ID="*Univention"*$' /etc/lsb-release
|
2017-01-18 09:30:05 +01:00
|
|
|
then
|
|
|
|
# normal UCS setup
|
|
|
|
/usr/share/egroupware/doc/rpm-build/post_install.php \
|
|
|
|
--distro univention \
|
|
|
|
--admin_user "Administrator" \
|
|
|
|
--admin_passwd "*unchanged*" 2>&1 | /usr/bin/tee -a $install_log
|
2017-11-13 17:41:08 +01:00
|
|
|
else
|
2018-10-10 10:46:42 +02:00
|
|
|
# for non-interactive install let post_install generate passwords
|
|
|
|
if [ "$DEBIAN_FRONTEND" = "noninteractive" ]
|
|
|
|
then
|
|
|
|
/usr/share/egroupware/doc/rpm-build/post_install.php 2>&1 | /usr/bin/tee -a $install_log
|
|
|
|
else
|
|
|
|
# Get configuration passwords
|
|
|
|
db_get "egroupware/header/user"
|
|
|
|
header_user="$RET"
|
|
|
|
db_get "egroupware/header/password"
|
|
|
|
header_password="$RET"
|
2017-11-13 17:41:08 +01:00
|
|
|
|
2018-10-10 10:46:42 +02:00
|
|
|
# Get first egroupware user / pw
|
|
|
|
db_get "egroupware/admin/user"
|
|
|
|
admin_user="$RET"
|
|
|
|
db_get "egroupware/admin/password"
|
|
|
|
admin_password="$RET"
|
2017-11-13 17:41:08 +01:00
|
|
|
|
2018-10-10 10:46:42 +02:00
|
|
|
# Get egroupware language
|
|
|
|
db_get "egroupware/lang"
|
|
|
|
lang="$RET"
|
2017-11-13 17:41:08 +01:00
|
|
|
|
2018-10-10 10:46:42 +02:00
|
|
|
# Get mysql root / pw
|
|
|
|
db_get "egroupware/db_root"
|
|
|
|
db_root="$RET"
|
|
|
|
db_get "egroupware/db_root_pw"
|
|
|
|
db_root_pw="$RET"
|
2017-11-13 17:41:08 +01:00
|
|
|
|
2018-10-10 10:46:42 +02:00
|
|
|
/usr/share/egroupware/doc/rpm-build/post_install.php \
|
|
|
|
--config_user "$header_user" \
|
|
|
|
--config_passwd "$header_password" \
|
|
|
|
--admin_user "$admin_user" \
|
|
|
|
--admin_passwd "$admin_password" \
|
|
|
|
--lang "$lang" \
|
|
|
|
--db_type mysql \
|
|
|
|
--db_root "$db_root" \
|
|
|
|
--db_root_pw "$db_root_pw" 2>&1 | /usr/bin/tee -a $install_log
|
|
|
|
fi
|
2017-11-13 17:41:08 +01:00
|
|
|
fi
|
2014-12-09 19:01:27 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "EGroupware install log saved to $install_log"
|
|
|
|
|
|
|
|
# Only change permissions during initial installation, in case
|
|
|
|
# someone wants a different setup.
|
|
|
|
if [ -z "$2" ]; then
|
|
|
|
chown -R www-data:www-data /var/lib/egroupware/
|
2018-06-09 10:05:44 +02:00
|
|
|
chmod 700 /var/lib/egroupware/
|
2014-12-09 19:01:27 +01:00
|
|
|
chmod 600 $config
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set up web server and reload it.
|
2017-11-13 17:41:08 +01:00
|
|
|
if [ -d /etc/nginx ]
|
|
|
|
then
|
|
|
|
ln -fs ../../egroupware/nginx.conf /etc/nginx/sites-available/egroupware.conf
|
|
|
|
# initial install: enable egroupware and disable default site
|
|
|
|
if [ -z "$2" ]
|
|
|
|
then
|
|
|
|
ln -fs /etc/nginx/sites-available/egroupware.conf /etc/nginx/sites-enabled/
|
|
|
|
rm -f /etc/nginx/sites-enabled/default
|
|
|
|
fi
|
|
|
|
nginx -s reload
|
2014-12-09 19:01:27 +01:00
|
|
|
else
|
2017-11-17 10:35:56 +01:00
|
|
|
# use either apache.conf or apache-univention.conf for extra open_basedir
|
|
|
|
apache_conf=apache.conf
|
2017-11-17 11:38:19 +01:00
|
|
|
test -f /etc/lsb-release && grep -q '^DISTRIB_ID="*Univention"*$' /etc/lsb-release && apache_conf=apache-univention.conf
|
2017-11-17 10:35:56 +01:00
|
|
|
|
2017-11-13 17:41:08 +01:00
|
|
|
if [ -d /etc/apache2/conf.d ] ; then
|
2017-11-17 10:35:56 +01:00
|
|
|
ln -fs ../../egroupware/$apache_conf /etc/apache2/conf.d/egroupware
|
2017-11-13 17:41:08 +01:00
|
|
|
else
|
|
|
|
if [ -d /etc/apache2/sites-available ] ; then
|
2017-11-17 10:35:56 +01:00
|
|
|
ln -fs ../../egroupware/$apache_conf /etc/apache2/sites-available/egroupware.conf
|
2017-11-13 17:41:08 +01:00
|
|
|
a2ensite egroupware
|
|
|
|
fi
|
2014-12-09 19:01:27 +01:00
|
|
|
fi
|
2017-11-13 17:41:08 +01:00
|
|
|
a2enmod actions >/dev/null
|
|
|
|
webserver_soft_reload apache2
|
2014-12-09 19:01:27 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
#DEBHELPER#
|
|
|
|
|
|
|
|
db_stop
|