From b15fe235cca01f678940acaaa31433f02ed85b31 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Thu, 15 Dec 2022 21:16:35 +0100 Subject: mailsync: check for tool dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- bin/hibiki/mailsync | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/hibiki/mailsync b/bin/hibiki/mailsync index bea6e83..2009474 100755 --- a/bin/hibiki/mailsync +++ b/bin/hibiki/mailsync @@ -3,6 +3,14 @@ set -e [ -n "$DEBUG" ] && set -x +# check requirements +for tool in mbsync notify-send python awk gdbus iconez; do + if ! command -v "$tool" >/dev/null; then + printf '%s: %s not installed but required\n' "$(basename "$0")" "$tool" >&2 + exit 1 + fi +done + maildir="${HOME}/mail" cachefile=${XDG_CACHE_HOME}/mailsync.lastrun @@ -132,7 +140,7 @@ run_sync() { "$id" >/dev/null # index new messages - command notmuch >/dev/null && notmuch new + command notmuch >/dev/null 2>&1 && notmuch new } # only list new mail, don't sync -- cgit 1.4.1