upgrade script

This commit is contained in:
uwe 2022-02-13 11:30:06 +01:00
parent 182aee6bb8
commit 1b561ee10f

38
upgrade_snappymail Normal file
View file

@ -0,0 +1,38 @@
#!/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 <pychi@gmx.de>
# 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
curl -L -s $GITHUB_URL | grep -m 1 "href.*snappymail.*tar.gz" | sed "s/^.*href=\"//g" | sed "s/\".*$//g" | wget --base=http://github.com -i - -O snappy.tar.gz
# 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 upgrading snappymail ... \033[0m"