From ba1642b291d1785271ed4490cbed594a02f42888 Mon Sep 17 00:00:00 2001 From: "b.waal" Date: Sat, 31 Aug 2019 20:51:43 +0200 Subject: [PATCH] Add 'config/rainloop/update-tools.sh' --- config/rainloop/update-tools.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 config/rainloop/update-tools.sh diff --git a/config/rainloop/update-tools.sh b/config/rainloop/update-tools.sh new file mode 100644 index 0000000..2e91a82 --- /dev/null +++ b/config/rainloop/update-tools.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +### Begin update tool script + +new_signature=$(curl -s "https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip.asc") +old_signature=$(cat "/var/log/rainloop-installed.asc" || true) +TMPDIR=$(mktemp -d) + +printf "RainLoop: checking for upgrades... " + +if [ "$new_signature" != "$old_signature" ]; +then + echo "found" + echo "RainLoop: upgrading..." + + wget http://www.rainloop.net/repository/webmail/rainloop-community-latest.zip -O $TMPDIR/rlcl.zip + unzip -q $TMPDIR/rlcl.zip -d $TMPDIR + cp -r $TMPDIR/rainloop /opt/rainloop/ + cp -r $TMPDIR/data/EMPTY /opt/rainloop/data/EMPTY + cp -r $TMPDIR/data/VERSION /opt/rainloop/data/VERSION + cp -r $TMPDIR/index.php /opt/rainloop/index.php + rm -rf $TMPDIR + chown -R www-data:www-data /opt/rainloop + find /opt/rainloop/ -type d -exec chmod 755 {} \; + find /opt/rainloop/ -type f -exec chmod 644 {} \; + echo "$new_signature" > /var/log/rainloop-installed.asc + + echo "RainLoop: upgrade complete" +else + echo "not found" +fi +echo "Done" + +### End update tool script \ No newline at end of file