Browse Source

Ajouter 'maj_element.sh'

master
nemesis 7 months ago
parent
commit
354f6567a5
  1. 44
      maj_element.sh

44
maj_element.sh

@ -0,0 +1,44 @@
#!/bin/bash
if [ $# -ne 0 ]
then
echo "usage $(basename $0)"
exit 1
fi
function get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
version=$(get_latest_release vector-im/element-web)
echo "Debut de l installation de Element $version"
printf "Nettoyage et sauvegarde"
rm -rf element-v*
printf "."
rm -rf riot_old
printf "."
cp -Rp riot/ riot_old
printf ". OK!\n"
printf "Recuperation element.."
wget https://github.com/vector-im/element-web/releases/download/${version}/element-${version}.tar.gz 1>/dev/null 2>/dev/null
ret=$?
printf ". OK!\n"
if [ $ret -eq 0 ]
then
printf "Installation."
tar xzf element-${version}.tar.gz
printf "."
cp -Rp element-${version}/* riot/
printf "."
chown -R www-data:www-data riot
printf ". OK!\nInstallation finie.\n"
exit 0
else
echo "Recuperation impossible, arret"
exit 2
fi
Loading…
Cancel
Save