From 5c03e649133c6c59ceb09ca4ea0ce136b0b8c65f Mon Sep 17 00:00:00 2001 From: Siddharth Dushantha Date: Fri, 27 Mar 2020 20:06:54 +0100 Subject: [PATCH] added dependency checking --- kunst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kunst b/kunst index e4b0d51..9213490 100755 --- a/kunst +++ b/kunst @@ -171,7 +171,15 @@ pre_exit() { } main() { - + + dependencies=(sxiv imagemagick bash ffmpeg mpc jq mpd) + for dependency in "${dependencies[@]}"; do + type -p "$dependency" &>/dev/null || { + echo "error: Could not find '${dependency}', is it installed?" >&2 + exit 1 + } + done + [ "$KUNST_MUSIC_DIR" != "" ] && MUSIC_DIR="$KUNST_MUSIC_DIR" [ "$KUNST_SIZE" != "" ] && SIZE="$KUNST_SIZE" [ "$KUNST_POSITION" != "" ] && POSITION="$KUNST_POSITION"