77 lines
2.1 KiB
Bash
Executable File
77 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
####################################################################
|
|
##
|
|
## script to automaticaly update RIOT-web
|
|
##
|
|
####################################################################
|
|
|
|
# change working dir
|
|
cd /var/www/vhosts/solusar.de/subdomains/
|
|
|
|
# check if there is an active installation
|
|
if [ -d riot ]
|
|
then
|
|
# find old version number
|
|
oldver=`cat riot/version`
|
|
echo "Installed version is $oldver"
|
|
read -p "Need to update (Y/n)? " answer
|
|
else
|
|
echo "There is no active RIOT-web installation! Exiting..."
|
|
exit 1
|
|
fi
|
|
|
|
case "$answer" in
|
|
Y|y|"")
|
|
# ask for the new version number to install
|
|
read -p "Upgrade to which version (format x.x.x[-rcX])? " ver
|
|
if [ -n $ver ]
|
|
then
|
|
# if theres an old version archive...
|
|
if [ -f riot-v$oldver.tar.gz ]
|
|
then
|
|
echo "Found old version archive. Removing..."
|
|
rm riot-v$oldver.tar.gz
|
|
fi
|
|
|
|
# download new version archive if nessesary
|
|
if [ ! -f riot-v$ver.tar.gz ]
|
|
then
|
|
echo "Getting new version..."
|
|
#wget https://github.com/vector-im/riot-web/releases/download/v$ver/riot-v$ver.tar.gz
|
|
wget https://github.com/vector-im/riot-web/releases/download/v$ver/riot-v$ver.tar.gz
|
|
fi
|
|
|
|
if [ -f riot-v$ver.tar.gz ]
|
|
then
|
|
echo "Unpacking..."
|
|
tar xzf riot-v$ver.tar.gz
|
|
|
|
# if there's an old version...
|
|
if [ -d riot.old ]
|
|
then
|
|
# delete the old version
|
|
rm -r riot.old
|
|
fi
|
|
mv riot riot.old
|
|
mv riot-v$ver riot
|
|
echo "Copying config..."
|
|
cp riot.old/config.riot.solusar.de.json riot/
|
|
cp riot.old/config.json riot/
|
|
echo "Changing permissions..."
|
|
chown -R www-data:www-data riot/
|
|
echo "Done."
|
|
else
|
|
echo "Could not download new version. Check URL or version number!"
|
|
exit 1
|
|
fi
|
|
fi
|
|
;;
|
|
N|n)
|
|
echo "Exiting..."
|
|
;;
|
|
*)
|
|
echo "Unknown action, exiting..."
|
|
;;
|
|
esac
|