chore: more accurate check for ncurses availability
This commit is contained in:
parent
e8606bee90
commit
4ee9059f95
|
@ -44,7 +44,7 @@ while [[ $# -gt 0 ]]; do
|
|||
shift
|
||||
done
|
||||
|
||||
check_has_programs dialog ncurses
|
||||
check_has_programs dialog ncurses=ncursesw6-config
|
||||
|
||||
# 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>&-); }
|
||||
|
|
|
@ -331,10 +331,22 @@ function parse_arguments() {
|
|||
|
||||
function check_has_programs() {
|
||||
local failed=()
|
||||
local tuple
|
||||
local program
|
||||
for program in "$@"; do
|
||||
local checkfile
|
||||
for tuple in "$@"; do
|
||||
program="${tuple%%=*}"
|
||||
checkfile="${tuple##*=}"
|
||||
if [[ -z "$checkfile" ]]; then
|
||||
type "$program" &>/dev/null \
|
||||
|| failed+=("$program")
|
||||
elif [[ "${checkfile:0:1}" == "/" ]]
|
||||
[[ -e "$checkfile" ]] \
|
||||
|| failed+=("$program")
|
||||
else
|
||||
type "$checkfile" &>/dev/null \
|
||||
|| failed+=("$program")
|
||||
fi
|
||||
done
|
||||
|
||||
[[ "${#failed[@]}" -eq 0 ]] \
|
||||
|
|
Loading…
Reference in New Issue