From 4264d830e6ee7417130b69f337250a00d35c181e Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Mon, 8 Feb 2021 15:26:59 +0000 Subject: [PATCH] Adds a check to ensure required modules are installed --- install.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/install.sh b/install.sh index 4eadf0f..ba7df22 100644 --- a/install.sh +++ b/install.sh @@ -2,6 +2,7 @@ # Variables CYAN_BOLD='\033[1;96m' +YELLOW_BOLD='\033[1;93m' RED_BOLD='\033[1;31m' PLAIN_BOLD='\033[1;37m' @@ -15,6 +16,26 @@ printf "${CYAN_BOLD}" printf "│\n" printf "╰──────────────────────╯\n" +# Checks if a given package is installed +command_exists () { + hash "$1" 2> /dev/null +} + +# Shows warning if required modules are missing +system_verify () { + + if ! command_exists $1; then + printf "${YELLOW_BOLD}Warning:" + printf "${PLAIN_BOLD} $1 is not installed\n" + fi +} + +system_verify "zsh" +system_verify "vim" +system_verify "git" +system_verify "tmux" + + set -e CONFIG=".install.conf.yaml"