summaryrefslogtreecommitdiffstats
path: root/debian/patches/dont_auto_create_keypair
blob: ec0156491858861b5ffaf76d7251fbc5cf508a9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From: Ben Hutchings <ben@decadent.org.uk>
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 <ben@decadent.org.uk>

--- 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-<author-id>.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):