Ver Fonte

#1917 Improve update script for Roundcube (#2056)

* Do not delete upgrade.conf

It also list the versions for roundcube/rainloop/phpmailer and so on.

* Improve upgrade script roudcube

Prevent changes by users getting lost by user when he is using an own module / non default module
Also copies hidden files on install

* Change owner to root:www-data

* Update changelog
Jaap Marcus há 4 anos atrás
pai
commit
32f3a6a066
4 ficheiros alterados com 25 adições e 29 exclusões
  1. 2 0
      CHANGELOG.md
  2. 23 23
      bin/v-add-sys-roundcube
  3. 0 5
      func/upgrade.sh
  4. 0 1
      src/deb/hestia/postinst

+ 2 - 0
CHANGELOG.md

@@ -7,6 +7,8 @@ All notable changes to this project will be documented in this file.
 
 ### Bugfixes
 
+- Improve handling upgrade of Roundcube #1917
+
 ## [1.4.10] - Service release 
 
 ### Features

+ 23 - 23
bin/v-add-sys-roundcube

@@ -89,7 +89,7 @@ if [ "$UPDATE" == "no" ]; then
     [ ! -f "${RC_INSTALL_DIR}/${RC_FILE}" ] && wget "$RC_URL" --retry-connrefused --quiet -O "${RC_INSTALL_DIR}/${RC_FILE}"
     
     tar xzf $RC_FILE
-    cp -rf $RC_EXTRACT/* $RC_INSTALL_DIR
+    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
@@ -111,11 +111,20 @@ if [ "$UPDATE" == "no" ]; then
     ln -s $RC_CONFIG_DIR/plugins/newmail_notifier/config.inc.php ./plugins/newmail_notifier/config.inc.php
     cp -f $HESTIA_INSTALL_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    
+    chown -R root:www-data $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
     
-    chmod 640 $RC_CONFIG_DIR/config.inc.php
-    chown root:www-data $RC_CONFIG_DIR/config.inc.php
-    
+    chown -R root:www-data $RC_INSTALL_DIR
+  
     # Log file 
     if [ ! -d  $RC_LOG ];then
         mkdir $RC_LOG
@@ -146,10 +155,6 @@ if [ "$UPDATE" == "no" ]; then
     rm -f -r $RC_INSTALL_DIR/$RC_FILE;
     rm -f -r $RC_INSTALL_DIR/$RC_EXTRACT;
     
-    # Add robots.txt
-    echo "User-agent: *" > /var/lib/roundcube/robots.txt
-    echo "Disallow: /" >> /var/lib/roundcube/robots.txt
-    
     # Updating hestia.conf
     if [ -z "$(grep WEBMAIL_SYSTEM $HESTIA/conf/hestia.conf)" ]; then
         $BIN/v-change-sys-config-value 'WEBMAIL_SYSTEM' 'roundcube'
@@ -165,27 +170,22 @@ if [ "$UPDATE" == "no" ]; then
     
     phpenmod mcrypt > /dev/null 2>&1
 else
-    rm  -f -r $RC_INSTALL_DIR
-    mkdir $RC_INSTALL_DIR
     cd "$RC_INSTALL_DIR"
     [ ! -f "${RC_INSTALL_DIR}/${RC_FILE}" ] && wget "$RC_URL" --quiet -O "${RC_INSTALL_DIR}/${RC_FILE}"
     
     tar xzf $RC_FILE
-    cp -rf $RC_EXTRACT/* $RC_INSTALL_DIR
     
-    cp -f $RC_INSTALL_DIR/config/defaults.inc.php $RC_CONFIG_DIR/defaults.inc.php
-    rm -f -r $RC_INSTALL_DIR/config/
-    ln -s $RC_CONFIG_DIR/ ./config
-
-    ln -s $RC_CONFIG_DIR/plugins/password/config.inc.php ./plugins/password/config.inc.php
-    ln -s $RC_CONFIG_DIR/plugins/newmail_notifier/config.inc.php ./plugins/newmail_notifier/config.inc.php
-    ln -s $RC_CONFIG_DIR/plugins/zipdownload/config.inc.php ./plugins/zipdownload/config.inc.php  
+    # 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
+    chown -R root:www-data $RC_INSTALL_DIR
     
-    $RC_INSTALL_DIR/bin/update.sh --version "$version"
-        
-    rm -f -r $RC_INSTALL_DIR/installer;
-    rm -f -r $RC_INSTALL_DIR/$RC_FILE;
-    rm -f -r $RC_INSTALL_DIR/$RC_EXTRACT;  
+    #clean up the mess
+    if [ -d "$RC_INSTALL_DIR/installer" ]; then
+        rm -f -r $RC_INSTALL_DIR/installer
+    fi
+    rm -f -r $RC_INSTALL_DIR/$RC_FILE
+    rm -f -r $RC_INSTALL_DIR/$RC_EXTRACT
 fi
 #----------------------------------------------------------#
 #                       Logging                            #

+ 0 - 5
func/upgrade.sh

@@ -720,8 +720,3 @@ upgrade_restart_services() {
     fi
     $BIN/v-restart-service hestia
 }
-
-upgrade_perform_cleanup() {
-    # Remove upgrade configuration file as it's not needed
-    rm -f $HESTIA_INSTALL_DIR/upgrade/upgrade.conf
-}

+ 0 - 1
src/deb/hestia/postinst

@@ -92,7 +92,6 @@ upgrade_set_branch $new_version
 upgrade_cleanup_message | tee -a $LOG
 upgrade_rebuild_users | tee -a $LOG
 upgrade_restart_services | tee -a $LOG
-upgrade_perform_cleanup | tee -a $LOG
 
 # Add upgrade notification to admin user's panel and display completion message
 upgrade_complete_message_log >> $LOG