0x1949 Team - FAZEMRX - MANAGER
Edit File: cpanel-roundcubemail.preinst
#!/bin/sh set -e export ROUNDCUBE_ROOT=/usr/local/cpanel/base/3rdparty/roundcube export ROUNDCUBE_DATA=/var/cpanel/roundcube ## <asset scriplets/pre> # shared script with debian/preinst and rpm %pre # please keep these two in sync runPreInst() { # check to see if we're NOT in an initial install situation (there will be no database to backup) # if [ "x$CPANEL_BASE_INSTALL" != "x" ]; then /bin/echo "No MySQL server (or tools) are available, skipping roundcube database backup." /bin/echo "NOTE: Fresh installs will not have a database to backup." return fi # do a backup of the existing database if the database exists # HAS_DB=$(/usr/local/cpanel/3rdparty/bin/perl -e 'qx{mysqlshow roundcube >/dev/null 2>&1}; print qq[ok] if $? == 0') if [ "x${HAS_DB}" = "x" ]; then /bin/echo 'No existing Roundcube database detected; skipping database backup.' return fi DATE="$(date '+%s')" BACKUP_FILE=${ROUNDCUBE_DATA}/roundcube.backup.sql.${DATE} /bin/echo "Archiving current Roundcube data to ${BACKUP_FILE}" mysqldump --no-create-db --skip-comments --complete-insert \ --ignore-table=roundcube.cache --ignore-table=roundcube.session \ --ignore-table=roundcube.messages --databases roundcube \ > ${BACKUP_FILE} /bin/echo "Roundcube DB successfully archived" # ensure the latest backup symlink is correct # /bin/ln -sf ${BACKUP_FILE} ${ROUNDCUBE_DATA}/latest # New config takes precedence as of 120; Use inc.d for customizations # if [ -f /usr/local/cpanel/base/3rdparty/roundcube/plugins/calendar/config.inc.php ] ; then /bin/cp /usr/local/cpanel/base/3rdparty/roundcube/plugins/calendar/config.inc.php ${ROUNDCUBE_DATA}/calendar_config.inc.${DATE} || true fi } ## </asset> case "$1" in install) runPreInst; ;; esac exit 0