hs.scripts/updates/element.sh

33 lines
935 B
Bash
Raw Permalink Normal View History

2024-04-25 13:49:12 +02:00
#!/bin/bash
set -e
# we could also do a "jq -r '.assets[0].browser_download_url'"
# but we rather reuse that tag later because the download_url
# tends to be static anyways
release=`curl -L https://api.github.com/repos/element-hq/element-web/releases/latest -s | jq -r '.tag_name'`
basedir="$HOME"
deploydir="$basedir/element"
tmpdir=/tmp/$USER
mkdir -p $tmpdir
cd $tmpdir
echo ">>> downloading and extracting Element $release"
wget -q --show-progress https://github.com/element-hq/element-web/releases/download/$release/element-$release.tar.gz
tar -zxf element-$release.tar.gz
echo
echo ">>> syncing $tmpdir/element-$release to $deploydir/"
rsync -aAX --delete --exclude="config.json" $tmpdir/element-$release/ $deploydir/
#echo ">>> (re)linking config (just in case)"
#ln -sv $basedir/config.json $basedir/element/
echo
echo ">>> cleaning up..."
rm -r $tmpdir/element-$release
rm $tmpdir/element*.tar.gz
echo
echo ">>> done."