chore: more accurate check for ncurses availability

This commit is contained in:
oddlama 2021-12-06 13:34:27 +01:00
parent e8606bee90
commit 4ee9059f95
No known key found for this signature in database
GPG Key ID: 14EFE510775FE39A
2 changed files with 16 additions and 4 deletions

2
configure vendored
View File

@ -44,7 +44,7 @@ while [[ $# -gt 0 ]]; do
shift shift
done done
check_has_programs dialog ncurses check_has_programs dialog ncurses=ncursesw6-config
# Wrap dialog in two functions to prevent it from cluttering stderr. # Wrap dialog in two functions to prevent it from cluttering stderr.
function dialog_wrapper() { dialog_out=$(command dialog --colors "$@" 3>&2 2>&1 1>&3 3>&-); } function dialog_wrapper() { dialog_out=$(command dialog --colors "$@" 3>&2 2>&1 1>&3 3>&-); }

View File

@ -331,10 +331,22 @@ function parse_arguments() {
function check_has_programs() { function check_has_programs() {
local failed=() local failed=()
local tuple
local program local program
for program in "$@"; do local checkfile
for tuple in "$@"; do
program="${tuple%%=*}"
checkfile="${tuple##*=}"
if [[ -z "$checkfile" ]]; then
type "$program" &>/dev/null \ type "$program" &>/dev/null \
|| failed+=("$program") || failed+=("$program")
elif [[ "${checkfile:0:1}" == "/" ]]
[[ -e "$checkfile" ]] \
|| failed+=("$program")
else
type "$checkfile" &>/dev/null \
|| failed+=("$program")
fi
done done
[[ "${#failed[@]}" -eq 0 ]] \ [[ "${#failed[@]}" -eq 0 ]] \