From 14ccdf48b61e400fd45e180cd0a16e8f99bd0678 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 17 Jul 2016 02:58:20 +0200 Subject: make deploy: admit debug --- Makefile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index e6a8eeb95..3857a2390 100644 --- a/Makefile +++ b/Makefile @@ -41,17 +41,17 @@ target_path ?= $(_target_path) endif endif -export target_host ?= $(system) -export target_user ?= root -export target_port ?= 22 -export target_path ?= /var/src +target_host ?= $(system) +target_user ?= root +target_port ?= 22 +target_path ?= /var/src $(if $(target_host),,$(error unbound variable: target_host)) $(if $(target_user),,$(error unbound variable: target_user)) $(if $(target_port),,$(error unbound variable: target_port)) $(if $(target_path),,$(error unbound variable: target_path)) -export target ?= $(target_user)@$(target_host):$(target_port)$(target_path) +target ?= $(target_user)@$(target_host):$(target_port)$(target_path) build = \ nix-build \ @@ -75,11 +75,17 @@ $(error No goals specified) endif # usage: make deploy system=foo [target_host=bar] +ifeq ($(debug),true) +deploy: rebuild-command = dry-activate +else +deploy: rebuild-command = switch +endif deploy: ssh ?= ssh -deploy: populate +deploy: + $(MAKE) populate debug=false $(ssh) $(target_user)@$(target_host) -p $(target_port) \ env STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \ - nixos-rebuild switch --show-trace -I $(target_path) + nixos-rebuild $(rebuild-command) --show-trace -I $(target_path) # usage: make populate system=foo ifeq ($(debug),true) -- cgit v1.2.3