added dependency checking

This commit is contained in:
Siddharth Dushantha 2020-03-27 20:06:54 +01:00
parent 03e3520311
commit 5c03e64913
1 changed files with 9 additions and 1 deletions

8
kunst
View File

@ -172,6 +172,14 @@ pre_exit() {
main() { 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_MUSIC_DIR" != "" ] && MUSIC_DIR="$KUNST_MUSIC_DIR"
[ "$KUNST_SIZE" != "" ] && SIZE="$KUNST_SIZE" [ "$KUNST_SIZE" != "" ] && SIZE="$KUNST_SIZE"
[ "$KUNST_POSITION" != "" ] && POSITION="$KUNST_POSITION" [ "$KUNST_POSITION" != "" ] && POSITION="$KUNST_POSITION"