Skip to content

Commit 32f3a6a

Browse files
authored
hestiacp#1917 Improve update script for Roundcube (hestiacp#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
1 parent 267076b commit 32f3a6a

File tree

4 files changed

+25
-29
lines changed

4 files changed

+25
-29
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ All notable changes to this project will be documented in this file.
77

88
### Bugfixes
99

10+
- Improve handling upgrade of Roundcube #1917
11+
1012
## [1.4.10] - Service release
1113

1214
### Features

bin/v-add-sys-roundcube

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -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
167172
else
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
189189
fi
190190
#----------------------------------------------------------#
191191
# Logging #

func/upgrade.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,3 @@ upgrade_restart_services() {
720720
fi
721721
$BIN/v-restart-service hestia
722722
}
723-
724-
upgrade_perform_cleanup() {
725-
# Remove upgrade configuration file as it's not needed
726-
rm -f $HESTIA_INSTALL_DIR/upgrade/upgrade.conf
727-
}

src/deb/hestia/postinst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ upgrade_set_branch $new_version
9292
upgrade_cleanup_message | tee -a $LOG
9393
upgrade_rebuild_users | tee -a $LOG
9494
upgrade_restart_services | tee -a $LOG
95-
upgrade_perform_cleanup | tee -a $LOG
9695

9796
# Add upgrade notification to admin user's panel and display completion message
9897
upgrade_complete_message_log >> $LOG

0 commit comments

Comments
 (0)