Roundcube Update-Script
Code
#!/bin/bash
echo "Welcome to the Roundcube-Mail Update Script"
echo "Type the newest Roundcube version for example: 1.4.9, followed by [ENTER]:"
read version
ROUNDCUBE_DIR=/var/www
#1 Switch to /tmp directory
cd /tmp
#2 Download the package with wget
wget https://github.com/roundcube/roundcubemail/releases/download/${version}/roundcubemail-${version}-complete.tar.gz
if [ $? -eq 0 ]; then
echo "DOWNLOAD OK"
else
echo "DOWNLOAD FAILED"
exit 1
fi
#3 Extract the package
tar xf roundcubemail-${version}-complete.tar.gz
#4 create backup
sudo -u www-data cp -arf ${ROUNDCUBE_DIR}/roundcube ${ROUNDCUBE_DIR}/roundcube.BAK/
#5 Install/Update
sudo -u www-data ./roundcubemail-${version}/bin/installto.sh ${ROUNDCUBE_DIR}/roundcube/
#6 remove installer directory
echo "${ROUNDCUBE_DIR}/roundcube/installer"
sudo -u www-data [ -d "${ROUNDCUBE_DIR}/roundcube/installer" ] && rm -rf ${ROUNDCUBE_DIR}/roundcube/installer/
sudo -u www-data [ ! -d "${ROUNDCUBE_DIR}/roundcube/installer" ] && echo "INSTALLER DIRECTORY ALREADY REMOVED!"
#7 remove package
rm roundcubemail-${version}-complete.tar.gz
rm -rf roundcubemail-${version}
#8 (Update composer if necessary)
cd ${ROUNDCUBE_DIR}/roundcube/
sudo -u www-data php composer.phar update --no-dev
echo "DEPENDENCIES UPDATED"
echo "UPDATE FINISHED"