Skip to content

Commit

Permalink
Merge pull request #60 from druidfi/mkcert-arm-install
Browse files Browse the repository at this point in the history
Mkcert ARM install
  • Loading branch information
back-2-95 authored Jan 12, 2022
2 parents c7d8bf0 + ddf7591 commit d9192b9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion make/os.mk
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ endif
# macOS additions
#
ifeq ($(OS_ID_LIKE),darwin)
BREW_BIN := $(shell which brew || echo no)
BREW_BIN := $(shell command -v brew || echo no)
endif
14 changes: 7 additions & 7 deletions make/plugins/01-mkcert.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MKCERT_BIN := $(shell which mkcert || echo no)
MKCERT_BIN := $(shell command -v mkcert || echo no)
MKCERT_BIN_PATH := /usr/local/bin/mkcert
MKCERT_REPO := https://github.com/FiloSottile/mkcert
MKCERT_REQS_ARCH := nss
Expand All @@ -10,23 +10,20 @@ UP_PRE_TARGETS += mkcert-install certs
ifeq ($(OS_ID_LIKE),darwin)
MKCERT_SOURCE := ${MKCERT_REPO}/releases/download/${MKCERT_VERSION}/mkcert-${MKCERT_VERSION}-darwin-amd64
else
MKCERT_SOURCE := ${MKCERT_REPO}/releases/download/${MKCERT_VERSION}/mkcert-${MKCERT_VERSION}-linux-amd64
MKCERT_SOURCE := ${MKCERT_REPO}/releases/download/${MKCERT_VERSION}/mkcert-${MKCERT_VERSION}-linux-$(CURRENT_ARCH)
endif

PHONY += mkcert-install
mkcert-install: ## Install mkcert
ifeq ($(MKCERT_BIN),$(MKCERT_BIN_PATH))
$(call step,Install mkcert)
$(call item,mkcert is already installed 👍)
else
ifeq ($(MKCERT_BIN),no)
# macOS starts
ifeq ($(OS_ID_LIKE),darwin)
ifeq ($(BREW_BIN),no)
$(call step,Download mkcert binary and make it executable)
@curl -# -L ${MKCERT_SOURCE} -o ${MKCERT_BIN_PATH}
@chmod +x ${MKCERT_BIN_PATH}
else
$(call step,Install mkcert with brew)
$(call step,Install mkcert with brew $(MKCERT_BIN))
@brew install mkcert
endif
# macOS ends
Expand All @@ -44,6 +41,9 @@ endif
@sudo chmod +x ${MKCERT_BIN_PATH}
endif
# Linux ends
else
$(call step,Install mkcert)
$(call item,mkcert is already installed 👍)
endif

#
Expand Down
25 changes: 18 additions & 7 deletions make/stonehenge.mk
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
include $(PROJECT_DIR)/make/os.mk

DOCKER_BIN := $(shell which docker || echo no)
DOCKER_COMPOSE_V2 := $(shell docker compose > /dev/null 2>&1 && echo "yes" || echo "no")

ifeq ($(DOCKER_COMPOSE_V2),yes)
DOCKER_COMPOSE_CMD := docker compose
ifeq ($(shell uname -m),arm64)
CURRENT_ARCH := arm64
else ifeq ($(shell uname -m),aarch64)
CURRENT_ARCH := arm64
else
DOCKER_COMPOSE_CMD := docker-compose
CURRENT_ARCH := amd64
endif

DOCKER_BIN := $(shell command -v docker || echo no)
DOCKER_COMPOSE_BIN := $(shell command -v docker-compose || echo no)
DOCKER_COMPOSE_CMD := docker-compose

NETWORK_NAME := $(PREFIX)-network
NETWORK_EXISTS := $(shell docker network inspect ${NETWORK_NAME} > /dev/null 2>&1 && echo "yes" || echo "no")
SSH_VOLUME_NAME := $(PREFIX)-ssh
Expand Down Expand Up @@ -39,7 +42,7 @@ PHONY += --up-pre-actions
PHONY += --up-title
--up-title:
$(call step,Start Stonehenge)
@echo "Startup Stonehenge on $(OS)"
@echo "Startup Stonehenge on $(OS) ($(CURRENT_ARCH))"

PHONY += --up-create-network
--up-create-network:
Expand Down Expand Up @@ -180,6 +183,14 @@ ifeq ($(DOCKER_BIN),no)
$(error docker is required)
endif

ifeq ($(DOCKER_BIN),no)
$(error docker is required)
endif

ifeq ($(DOCKER_COMPOSE_BIN),no)
$(error docker compose is required)
endif

ifeq ($(DOCKER_DOMAIN),)
$(error DOCKER_DOMAIN not set in .env)
endif
Expand Down
5 changes: 3 additions & 2 deletions make/utilities.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ debug:
$(call step,Debug:)
$(call val,Stonehenge version,$(STONEHENGE_VERSION))
$(call val,OS,$(OS))
$(call val,ARCH,$(CURRENT_ARCH))
$(call val,OS_ID,$(OS_ID))
$(call val,OS_ID_LIKE,$(OS_ID_LIKE))
$(call val,OS_VERSION,$(OS_VERSION))
$(call val,WSL,$(WSL))
$(call val,Docker installed,$(DOCKER_BIN))
$(call val,Docker Compose installed,$(DOCKER_COMPOSE_BIN))
$(call val,Docker version,$(shell docker --version))
$(call val,Docker domain,$(DOCKER_DOMAIN))
$(call val,Docker network name,$(NETWORK_NAME))
$(call val,docker-compose V2,$(DOCKER_COMPOSE_V2))
$(call val,Docker Compose V1,$(shell docker-compose > /dev/null 2>&1 && echo "yes" || echo "no"))
$(call val,docker-compose command,$(DOCKER_COMPOSE_CMD))
$(call val,mkcert installed,$(MKCERT_BIN))
ifeq ($(OS_ID_LIKE),darwin)
$(call val,brew installed,$(BREW_BIN))
$(call val,Homebrew installed,$(BREW_BIN))
endif

PHONY += help
Expand Down

0 comments on commit d9192b9

Please sign in to comment.