add listmonk update script

This commit is contained in:
Milan Ihl 2024-11-19 12:07:30 +01:00
parent 790727896b
commit a32b1ec412

27
updates/listmonk.sh Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
set -e
export XDG_RUNTIME_DIR=/run/user/$UID
release=`curl -L https://api.github.com/repos/knadh/listmonk/releases/latest -s | jq -r '.tag_name'`
# listmonks file identifier is lacking the 'v'
release=${release//v}
installdir=$HOME/bin
echo ">>> Listmonk is currently running: $($installdir/listmonk --version)"
echo "======== Latest release is [ $release ] ========"
read -p "=> Reply yY to proceed..." -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
fi
systemctl stop --user listmonk
curl -sL https://github.com/knadh/listmonk/releases/download/v$release/listmonk_${release}_linux_amd64.tar.gz | tar xvz -C $installdir/
$installdir/listmonk --upgrade
systemctl start --user listmonk
sleep 2
systemctl status --no-pager --user listmonk