#!/bin/bash if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi GITHUB_URL="https://github.com/the-djmaze/snappymail/releases/latest" YOUR_SERVER_FOLDER="/var/www/snappy.somesite.com/" # UPGRADING Snappymail # # I've found this to be working fine when upgrading my Snappymail. The # commands should be used at your own risk. I take no responsibility. # # This example assumes that Snappymail is installed in the following # folder; # # /var/www/snappy.somesite.com/ -- see $YOUR_SERVER_FOLDER # # Change the path to match your setup. # # By Uwe Bieling # Safty First ... make a backup cd $YOUR_SERVER_FOLDER && cd .. tar -czf backup_snappymail_`date +%Y%m%d`.tar.gz $YOUR_SERVER_FOLDER # Download last release to /tmp cd /tmp DOWNLOAD_DATA=`curl -L -s $GITHUB_URL | grep -m 1 "href.*snappymail.*tar.gz" | sed "s/^.*href=\"//g" | sed "s/\".*$//g"` echo $DOWNLOAD_DATA | wget --base=http://github.com -i - -O snappy.tar.gz # Get Versions OLD_VERSION=`cat $YOUR_SERVER_FOLDER"data/VERSION"` NEW_VERSION=`echo $DOWNLOAD_DATA | grep -o "v.*/"` # extract last release to folder tar -xzvf snappy.tar.gz -C $YOUR_SERVER_FOLDER # set permissions find $YOUR_SERVER_FOLDER -type d -exec chmod 755 {} \; find $YOUR_SERVER_FOLDER -type f -exec chmod 644 {} \; chown -R www-data:www-data $YOUR_SERVER_FOLDER echo -e "\033[1;32mFinished with snappymail-upgrade from $OLD_VERSION to ${NEW_VERSION:1:-1}... \033[0m"