From a3b858569764b38bbaa02a3a41cb6b9ea4e843fc Mon Sep 17 00:00:00 2001 From: Bradley Cicenas Date: Wed, 13 Jun 2018 09:20:05 +0000 Subject: [PATCH] add requirement check to install script --- install.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index e77bbda..d69c31e 100755 --- a/install.sh +++ b/install.sh @@ -6,7 +6,7 @@ KERNEL=$(uname -s) function output() { echo -e "\033[32mctop-install\033[0m $@"; } function command_exists() { - command -v "$@" > /dev/null 2>&1 + command -v "$@" > /dev/null 2>&1 } # extract github download url matching pattern @@ -32,6 +32,14 @@ case $KERNEL in ;; esac +for req in curl wget; do + command_exists $req || { + output "missing required $req binary" + req_failed=1 + } +done +[ "$req_failed" == 1 ] && exit 1 + sh_c='sh -c' if [ "$CURRENT_USER" != 'root' ]; then if command_exists sudo; then