hs.scripts/updates/listmonk.sh

27 lines
806 B
Bash
Raw Permalink Normal View History

2024-11-19 12:07:30 +01:00
#!/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