From a32b1ec4127804662706c76cffa4f48b2ceea776 Mon Sep 17 00:00:00 2001 From: Milan Ihl Date: Tue, 19 Nov 2024 12:07:30 +0100 Subject: [PATCH] add listmonk update script --- updates/listmonk.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 updates/listmonk.sh diff --git a/updates/listmonk.sh b/updates/listmonk.sh new file mode 100644 index 0000000..7fff156 --- /dev/null +++ b/updates/listmonk.sh @@ -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 \ No newline at end of file