@@ -89,7 +89,7 @@ if [ "$UPDATE" == "no" ]; then
8989 [ ! -f " ${RC_INSTALL_DIR} /${RC_FILE} " ] && wget " $RC_URL " --retry-connrefused --quiet -O " ${RC_INSTALL_DIR} /${RC_FILE} "
9090
9191 tar xzf $RC_FILE
92- cp -rf $RC_EXTRACT / * $RC_INSTALL_DIR
92+ cp -rT $RC_EXTRACT $RC_INSTALL_DIR
9393
9494 # Delete old config folder
9595 cp $RC_INSTALL_DIR /config/defaults.inc.php $RC_CONFIG_DIR /defaults.inc.php
@@ -111,11 +111,20 @@ if [ "$UPDATE" == "no" ]; then
111111 ln -s $RC_CONFIG_DIR /plugins/newmail_notifier/config.inc.php ./plugins/newmail_notifier/config.inc.php
112112 cp -f $HESTIA_INSTALL_DIR /roundcube/plugins/config_zipdownload.inc.php $RC_CONFIG_DIR /plugins/zipdownload/config.inc.php
113113 ln -s $RC_CONFIG_DIR /plugins/zipdownload/config.inc.php ./plugins/zipdownload/config.inc.php
114+ # Set up correct permissions roundcube
115+ chown -R root:www-data $RC_CONFIG_DIR /
116+ chmod 751 -R $RC_CONFIG_DIR
117+ chmod 644 $RC_CONFIG_DIR /config.inc.php
118+ chmod 644 $RC_CONFIG_DIR /plugins/password/config.inc.php
119+ chmod 644 $RC_CONFIG_DIR /plugins/newmail_notifier/config.inc.php
120+ chmod 644 $RC_CONFIG_DIR /plugins/zipdownload/config.inc.php
114121
122+ # Add robots.txt
123+ echo " User-agent: *" > /var/lib/roundcube/robots.txt
124+ echo " Disallow: /" >> /var/lib/roundcube/robots.txt
115125
116- chmod 640 $RC_CONFIG_DIR /config.inc.php
117- chown root:www-data $RC_CONFIG_DIR /config.inc.php
118-
126+ chown -R root:www-data $RC_INSTALL_DIR
127+
119128 # Log file
120129 if [ ! -d $RC_LOG ]; then
121130 mkdir $RC_LOG
@@ -146,10 +155,6 @@ if [ "$UPDATE" == "no" ]; then
146155 rm -f -r $RC_INSTALL_DIR /$RC_FILE ;
147156 rm -f -r $RC_INSTALL_DIR /$RC_EXTRACT ;
148157
149- # Add robots.txt
150- echo " User-agent: *" > /var/lib/roundcube/robots.txt
151- echo " Disallow: /" >> /var/lib/roundcube/robots.txt
152-
153158 # Updating hestia.conf
154159 if [ -z " $( grep WEBMAIL_SYSTEM $HESTIA /conf/hestia.conf) " ]; then
155160 $BIN /v-change-sys-config-value ' WEBMAIL_SYSTEM' ' roundcube'
@@ -165,27 +170,22 @@ if [ "$UPDATE" == "no" ]; then
165170
166171 phpenmod mcrypt > /dev/null 2>&1
167172else
168- rm -f -r $RC_INSTALL_DIR
169- mkdir $RC_INSTALL_DIR
170173 cd " $RC_INSTALL_DIR "
171174 [ ! -f " ${RC_INSTALL_DIR} /${RC_FILE} " ] && wget " $RC_URL " --quiet -O " ${RC_INSTALL_DIR} /${RC_FILE} "
172175
173176 tar xzf $RC_FILE
174- cp -rf $RC_EXTRACT /* $RC_INSTALL_DIR
175177
176- cp -f $RC_INSTALL_DIR /config/defaults.inc.php $RC_CONFIG_DIR /defaults.inc.php
177- rm -f -r $RC_INSTALL_DIR /config/
178- ln -s $RC_CONFIG_DIR / ./config
179-
180- ln -s $RC_CONFIG_DIR /plugins/password/config.inc.php ./plugins/password/config.inc.php
181- ln -s $RC_CONFIG_DIR /plugins/newmail_notifier/config.inc.php ./plugins/newmail_notifier/config.inc.php
182- ln -s $RC_CONFIG_DIR /plugins/zipdownload/config.inc.php ./plugins/zipdownload/config.inc.php
178+ # Run Roundcube upgrade script
179+ $RC_INSTALL_DIR /$RC_EXTRACT /bin/installto.sh -y $RC_INSTALL_DIR > /dev/null 2>&1
180+ $RC_INSTALL_DIR /bin/update.sh --version " $version " > /dev/null 2>&1
181+ chown -R root:www-data $RC_INSTALL_DIR
183182
184- $RC_INSTALL_DIR /bin/update.sh --version " $version "
185-
186- rm -f -r $RC_INSTALL_DIR /installer;
187- rm -f -r $RC_INSTALL_DIR /$RC_FILE ;
188- rm -f -r $RC_INSTALL_DIR /$RC_EXTRACT ;
183+ # clean up the mess
184+ if [ -d " $RC_INSTALL_DIR /installer" ]; then
185+ rm -f -r $RC_INSTALL_DIR /installer
186+ fi
187+ rm -f -r $RC_INSTALL_DIR /$RC_FILE
188+ rm -f -r $RC_INSTALL_DIR /$RC_EXTRACT
189189fi
190190# ----------------------------------------------------------#
191191# Logging #
0 commit comments