From: Ben Hutchings Subject: [PATCH] Don't automatically create key-pairs If the private key is missing, this is probably an error in the build configuration. Don't create a private key unless it's the only explicit goal for make. Signed-off-by: Ben Hutchings --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ REGDB_AUTHOR ?= $(shell if [ -f $(DISTRO echo custom-user; \ fi) -REGDB_PRIVKEY ?= ~/.wireless-regdb-$(REGDB_AUTHOR).key.priv.pem +REGDB_PRIVKEY ?= $(HOME)/.wireless-regdb-$(REGDB_AUTHOR).key.priv.pem REGDB_PUBKEY ?= $(REGDB_AUTHOR).key.pub.pem REGDB_PUBCERT ?= $(REGDB_AUTHOR).x509.pem @@ -85,8 +85,15 @@ $(REGDB_PUBCERT): $(REGDB_PRIVKEY) $(REGDB_PRIVKEY): +ifeq ($(MAKECMDGOALS),$(REGDB_PRIVKEY)) @echo "Generating private key for $(REGDB_AUTHOR)..." openssl genrsa -out $(REGDB_PRIVKEY) 2048 +else + @echo "No private key found. To generate a private key, run:" + @echo " make ~/.wireless-regdb-.key.priv.pem" + @echo "Your author-id is currently \"$(REGDB_AUTHOR)\"; set REGDB_AUTHOR to override this." + @exit 1 +endif ifneq ($(shell test -e $(DISTRO_PRIVKEY) && echo yes),yes) $(DISTRO_PRIVKEY):