diff --git a/init.mk b/init.mk index 47eb983..c8b3aa3 100644 --- a/init.mk +++ b/init.mk @@ -47,19 +47,39 @@ confirm: ######################################################################################################################## # Core Dependencies GIT ?= $(shell which git) -DOCKER ?= $(shell which docker) +DOCKER ?= $(shell which docker) +AWS_CLI ?= $(shell which aws) + +# Ensures that all dependencies are installed +prereqs: git docker aws-cli ssh-pub-key + +docker: +ifeq (, $(DOCKER)) + @echo "\033[31mX Docker is not installed or incorrectly configured. https://www.docker.com/ \033[0m" +else + @echo "\033[32m✔ Docker\033[0m" +endif -# Ensures git is installed - does not enforce version, please use latest git: ifeq (, $(GIT)) - $(error "Docker is not installed or incorrectly configured. https://www.docker.com/") -#else -# @$(DOCKER) --version + @echo "\033[31mX Git is not installed or incorrectly configured. https://git-scm.com/downloads/ \033[0m" +else + @echo "\033[32m✔ Git\033[0m" endif -EXECUTABLES = $(GIT) $(DOCKER) aws -K := $(foreach exec,$(EXECUTABLES),\ - $(if $(shell which $(exec)),some string,$(error "No $(exec) found in PATH. Please install it."))) +aws-cli: +ifeq (, $(AWS_CLI)) + @echo "\033[31mX AWS (CLI) is not installed or incorrectly configured. https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html/ \033[0m" +else + @echo "\033[32m✔ AWS (CLI)\033[0m" +endif + +ssh-pub-key: +ifeq (,$(wildcard ~/.ssh/id_rsa.pub)) + @echo "\033[31m! SSH Public Key is not found here: ~/.ssh/id_rsa.pub . Please make sure that you have a key and pass it via '$(SSH_PUBLIC_KEY)' variable. \033[0m" +else + @echo "\033[32m✔ SSH Public Key\033[0m" +endif # This ensures we include main.mk and variables.mk only if it's there. If not we don't error out (IE in case of bootstrap) -include $(INFRA_DIR)/icmk/variables.mk diff --git a/main.mk b/main.mk index 063f27c..9f5e368 100644 --- a/main.mk +++ b/main.mk @@ -51,7 +51,7 @@ SERVICE_NAME ?= $(ENV)-$(SVC) .PHONY: auth help all: help -env.debug: icmk.debug os.debug aws.debug +env.debug: prereqs icmk.debug os.debug aws.debug icmk.debug: @echo "\033[32m=== ICMK Info ===\033[0m" @echo "\033[36mENV\033[0m: $(ENV)" @@ -124,14 +124,6 @@ ECHO = @echo # Dependencies ######################################################################################################################## -# Ensures docker is installed - does not enforce version, please use latest -docker: -ifeq (, $(DOCKER)) - $(error "Docker is not installed or incorrectly configured. https://www.docker.com/") -#else -# @$(DOCKER) --version -endif - # Ensures docker-compose is installed - does not enforce. docker-compose: docker ifeq (, $(COMPOSE))