|
|
@@ -61,13 +61,13 @@ if [ -d "/usr/share/roundcube" ]; then
|
|
|
exit 2;
|
|
|
fi
|
|
|
|
|
|
-# Get current version
|
|
|
+# Get current version
|
|
|
if [ -f "/var/lib/roundcube/index.php" ]; then
|
|
|
version=$(cat $RC_INSTALL_DIR/index.php | grep -o -E '[0-9].[0-9].[0-9]+' | head -1);
|
|
|
if [ "$version" == "$rc_v" ]; then
|
|
|
echo "Error: Installed version ($version) is equal to the available version ($rc_v)"
|
|
|
exit 2;
|
|
|
- else
|
|
|
+ else
|
|
|
UPDATE="yes"
|
|
|
fi
|
|
|
fi
|
|
|
@@ -82,16 +82,16 @@ check_hestia_demo_mode
|
|
|
if [ "$UPDATE" == "no" ]; then
|
|
|
rm -f -r $RC_INSTALL_DIR
|
|
|
rm -f -r $RC_CONFIG_DIR
|
|
|
-
|
|
|
+
|
|
|
mkdir -p $RC_INSTALL_DIR/
|
|
|
mkdir -p $RC_CONFIG_DIR/
|
|
|
-
|
|
|
+
|
|
|
cd "$RC_INSTALL_DIR"
|
|
|
[ ! -f "${RC_INSTALL_DIR}/${RC_FILE}" ] && wget "$RC_URL" --retry-connrefused --quiet -O "${RC_INSTALL_DIR}/${RC_FILE}"
|
|
|
-
|
|
|
+
|
|
|
tar xzf $RC_FILE
|
|
|
cp -rT $RC_EXTRACT $RC_INSTALL_DIR
|
|
|
-
|
|
|
+
|
|
|
# Delete old config folder
|
|
|
cp $RC_INSTALL_DIR/config/defaults.inc.php $RC_CONFIG_DIR/defaults.inc.php
|
|
|
rm -f -r $RC_INSTALL_DIR/config/
|
|
|
@@ -100,41 +100,41 @@ if [ "$UPDATE" == "no" ]; then
|
|
|
cp -f $HESTIA_COMMON_DIR/roundcube/main.inc.php $RC_CONFIG_DIR/config.inc.php
|
|
|
cp -f $HESTIA_COMMON_DIR/roundcube/mimetypes.php $RC_CONFIG_DIR/mimetypes.php
|
|
|
chmod 644 $RC_CONFIG_DIR/*.php
|
|
|
-
|
|
|
+
|
|
|
cp -f $HESTIA_COMMON_DIR/roundcube/hestia.php $RC_INSTALL_DIR/plugins/password/drivers/
|
|
|
mkdir -p $RC_CONFIG_DIR/plugins/password
|
|
|
mkdir -p $RC_CONFIG_DIR/plugins/newmail_notifier
|
|
|
mkdir -p $RC_CONFIG_DIR/plugins/zipdownload
|
|
|
-
|
|
|
- # Allow changes to the respective config / Create symlinks to /etc/roundcube/
|
|
|
+
|
|
|
+ # Allow changes to the respective config / Create symlinks to /etc/roundcube/
|
|
|
cp -f $HESTIA_COMMON_DIR/roundcube/config.inc.php $RC_CONFIG_DIR/plugins/password/config.inc.php
|
|
|
ln -s $RC_CONFIG_DIR/plugins/password/config.inc.php ./plugins/password/config.inc.php
|
|
|
cp -f $HESTIA_COMMON_DIR/roundcube/plugins/config_newmail_notifier.inc.php $RC_CONFIG_DIR/plugins/newmail_notifier/config.inc.php
|
|
|
ln -s $RC_CONFIG_DIR/plugins/newmail_notifier/config.inc.php ./plugins/newmail_notifier/config.inc.php
|
|
|
cp -f $HESTIA_COMMON_DIR/roundcube/plugins/config_zipdownload.inc.php $RC_CONFIG_DIR/plugins/zipdownload/config.inc.php
|
|
|
ln -s $RC_CONFIG_DIR/plugins/zipdownload/config.inc.php ./plugins/zipdownload/config.inc.php
|
|
|
-
|
|
|
- # Set up correct permissions roundcube
|
|
|
+
|
|
|
+ # Set up correct permissions roundcube
|
|
|
chown -R root:www-data $RC_CONFIG_DIR/
|
|
|
- chmod 751 -R $RC_CONFIG_DIR
|
|
|
+ chmod 751 -R $RC_CONFIG_DIR
|
|
|
chmod 644 $RC_CONFIG_DIR/config.inc.php
|
|
|
chmod 644 $RC_CONFIG_DIR/plugins/password/config.inc.php
|
|
|
chmod 644 $RC_CONFIG_DIR/plugins/newmail_notifier/config.inc.php
|
|
|
chmod 644 $RC_CONFIG_DIR/plugins/zipdownload/config.inc.php
|
|
|
-
|
|
|
+
|
|
|
# Add robots.txt
|
|
|
echo "User-agent: *" > /var/lib/roundcube/robots.txt
|
|
|
echo "Disallow: /" >> /var/lib/roundcube/robots.txt
|
|
|
-
|
|
|
+
|
|
|
chown -R root:www-data $RC_INSTALL_DIR
|
|
|
-
|
|
|
- # Log file
|
|
|
+
|
|
|
+ # Log file
|
|
|
if [ ! -d $RC_LOG ];then
|
|
|
mkdir $RC_LOG
|
|
|
fi
|
|
|
chown www-data:www-data $RC_LOG
|
|
|
chmod 751 $RC_LOG
|
|
|
-
|
|
|
+
|
|
|
if [ ! -z "$(echo "$DB_SYSTEM" | grep -w 'mysql')" ]; then
|
|
|
mysql -e "DROP DATABASE IF EXISTS roundcube"
|
|
|
mysql -e "DROP USER IF EXISTS roundcube@localhost"
|
|
|
@@ -148,17 +148,17 @@ if [ "$UPDATE" == "no" ]; then
|
|
|
fi
|
|
|
|
|
|
# TODO: Add support for PostgreSQL
|
|
|
-
|
|
|
+
|
|
|
rcDesKey="$(openssl rand -base64 30 | tr -d "/" | cut -c1-24)"
|
|
|
sed -i "s/%des_key%/$rcDesKey/g" $RC_CONFIG_DIR/config.inc.php
|
|
|
# Update server hostname in password change plugin
|
|
|
sed -i "s/localhost/$(hostname)/g" $RC_CONFIG_DIR/plugins/password/config.inc.php
|
|
|
-
|
|
|
+
|
|
|
# Clean up
|
|
|
rm -f -r $RC_INSTALL_DIR/installer;
|
|
|
rm -f -r $RC_INSTALL_DIR/$RC_FILE;
|
|
|
rm -f -r $RC_INSTALL_DIR/$RC_EXTRACT;
|
|
|
-
|
|
|
+
|
|
|
# Updating hestia.conf
|
|
|
if [ -z "$(grep WEBMAIL_SYSTEM $HESTIA/conf/hestia.conf)" ]; then
|
|
|
$BIN/v-change-sys-config-value 'WEBMAIL_SYSTEM' 'roundcube'
|
|
|
@@ -171,20 +171,20 @@ if [ "$UPDATE" == "no" ]; then
|
|
|
fi
|
|
|
fi
|
|
|
fi
|
|
|
-
|
|
|
+
|
|
|
phpenmod mcrypt > /dev/null 2>&1
|
|
|
else
|
|
|
cd "$RC_INSTALL_DIR"
|
|
|
[ ! -f "${RC_INSTALL_DIR}/${RC_FILE}" ] && wget "$RC_URL" --quiet -O "${RC_INSTALL_DIR}/${RC_FILE}"
|
|
|
-
|
|
|
+
|
|
|
tar xzf $RC_FILE
|
|
|
-
|
|
|
+
|
|
|
# Run Roundcube upgrade script
|
|
|
$RC_INSTALL_DIR/$RC_EXTRACT/bin/installto.sh -y $RC_INSTALL_DIR > /dev/null 2>&1
|
|
|
$RC_INSTALL_DIR/bin/update.sh --version "$version" > /dev/null 2>&1
|
|
|
$RC_INSTALL_DIR/bin/indexcontacts.sh > /dev/null 2>&1
|
|
|
chown -R root:www-data $RC_INSTALL_DIR
|
|
|
-
|
|
|
+
|
|
|
#clean up the mess
|
|
|
if [ -d "$RC_INSTALL_DIR/installer" ]; then
|
|
|
rm -f -r $RC_INSTALL_DIR/installer
|