diff options
author | Suleyman Farajli <suleyman@farajli.net> | 2024-09-09 20:18:52 +0400 |
---|---|---|
committer | Suleyman Farajli <suleyman@farajli.net> | 2024-09-09 20:18:52 +0400 |
commit | 96a5d8db877b5b501c0d2e9f3dc5ee5c63fbd001 (patch) | |
tree | 65054000bfb50a7e13e06219896cc625fb44f26b /dep.sh | |
parent | bcadfd2a165f3b7c641a1b18ed8dc27d74745ed6 (diff) |
simple dependency checker added
Diffstat (limited to 'dep.sh')
-rwxr-xr-x | dep.sh | 58 |
1 files changed, 58 insertions, 0 deletions
@@ -0,0 +1,58 @@ +#!/bin/sh + +check() +{ + for program in "${@}"; do + if ! command -v "${program}" > /dev/null 2>&1; then + echo "'${program}' is missing." >&2 + retval=1; + fi + done; +} +check_double() +{ + if ! command -v "${1}" > /dev/null 2>&1 && ! command -v "${2}" > /dev/null 2>&1; then + echo "'${1}' is missing." >&2 + fi +} +check_with_msg() +{ + if ! command -v "${1}" > /dev/null 2>&1; then + echo "${2}" >&2 + retval=1; + fi +} + + +retval=0 + +# Configurated programs +check \ + git \ + lf \ + mpv \ + picom \ + qutebrowser \ + zathura + +check_double vim nvim # If at least one exists don't print error +check_double sxiv nsxiv +check_double zsh bash + +# Programs required by the scripts +check \ + dunst \ + scrot \ + brightnessctl + +check_with_msg pactl "pulseaudio is missing." + +# X11 dependencies +check \ + xinput \ + xset \ + xgamma + +check_with_msg startx "xorg-xinit is missing." + +return "${retval}" |