From 96a5d8db877b5b501c0d2e9f3dc5ee5c63fbd001 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Mon, 9 Sep 2024 20:18:52 +0400 Subject: simple dependency checker added --- Makefile | 6 +++++- dep.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100755 dep.sh diff --git a/Makefile b/Makefile index c9db4cd..4eb84a8 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,11 @@ directory: $(BOOKDIR) \ $(TESTPROJDIR) \ $(BINDIR) + +depcheck: + @./dep.sh + clean: rm -rf dwm st dmenu dwm.tar.gz st.tar.gz dmenu.tar.gz slstatus slstatus.tar.gz -.PHONY: all config scripts server desktop arch-linux directory dwm st dmenu slstatus clean full +.PHONY: all config scripts server desktop arch-linux directory dwm st dmenu slstatus clean full depcheck diff --git a/dep.sh b/dep.sh new file mode 100755 index 0000000..2ecd2a7 --- /dev/null +++ b/dep.sh @@ -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}" -- cgit v1.2.3