chiark / gitweb /
dot/gpg.conf.m4, dot/gpg-agent.conf, Makefile: Adopt GnuPG configuration. master
authorMark Wooding <mdw@distorted.org.uk>
Fri, 17 May 2024 16:09:05 +0000 (17:09 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 17 May 2024 16:09:05 +0000 (17:09 +0100)
Makefile
dot/gpg-agent.conf [new file with mode: 0644]
dot/gpg.conf.m4 [new file with mode: 0644]

index 8bfcef24b0b73f4bd94a9e0348bf290b06c6ae09..29359c000128daab370cd4a4a10f66da7a7cfc44 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,9 @@ v_print_0              = \
        printf "  %-8s %s\n" "$1" $(call quote,$(patsubst $(HOME)/%,~/%,$2));
 v_tag                   = $(V_AT)$(call v_print_$V,$1,$@)
 
+## Making directories.
+%/:; $(call v_tag,MKDIR)mkdir -p $@
+
 ## Hack.
 relax                   =
 
@@ -111,8 +114,8 @@ LOCAL_ELISP          = $(filter $(notdir $(wildcard el/*.el)), \
                                $(addsuffix .el, $(ELISP)))
 $(foreach e, $(LOCAL_ELISP), \
        $(eval DEP_$(basename $e) = $(EMACSLIB)/$(e:.el=.elc)))
-$(addprefix $(EMACSLIB)/, $(LOCAL_ELISP)): $(EMACSLIB)/%: el/%
-       $(call v_tag,SYMINK)mkdir -p $(EMACSLIB) && \
+$(addprefix $(EMACSLIB)/, $(LOCAL_ELISP)): $(EMACSLIB)/%: el/% | $(EMACSLIB)/
+       $(call v_tag,SYMINK) \
                rm -f $@.new && \
                ln -s $(HERE)/$< $@.new && \
                mv $@.new $@
@@ -129,8 +132,8 @@ $(foreach e, $(REMOTE_ELISP), \
                                          (error 1))))'; then \
                  echo t; \
                fi),, $(EMACSLIB)/$(e:.el=.elc))))
-$(addprefix $(EMACSLIB)/, $(REMOTE_ELISP)): $(EMACSLIB)/%:
-       $(call v_tag,FETCH)mkdir -p $(EMACSLIB) && \
+$(addprefix $(EMACSLIB)/, $(REMOTE_ELISP)): $(EMACSLIB)/%: | $(EMACSLIB)/
+       $(call v_tag,FETCH) \
                $(call get-url,$@.new,$(REPO)/$*) && \
                mv $@.new $@
 
@@ -234,10 +237,27 @@ DOTLINKS          += .tclshrc .wishrc
 ## The `nocss' machinery.
 SCRIPTLINKS            += nocss
 all: $(HOME)/lib/hacks/nocss/libdvdcss.so.2
-$(HOME)/lib/hacks/nocss/libdvdcss.so.2:
-       $(V_AT)mkdir -p $(dir $@)
+$(HOME)/lib/hacks/nocss/libdvdcss.so.2: | $$(dir $$@)
        $(call v_tag,TOUCH)touch $@
 
+## GnuPG.
+all: $(HOME)/.gnupg/gpg.conf
+$(HOME)/.gnupg/gpg.conf: \
+               dot/gpg.conf.m4 $(wildcard $(HOME)/.gnupg/gpg.local.conf) \
+               $(HOME)/.mdw.conf \
+               | $$(dir $$@)
+       $(call v_tag,M4)cd $(dir $@) && \
+       args= && \
+       key=$$(mdw-conf default-gpg-key nil) && \
+       case $$key in \
+         nil) ;; \
+         *) args=$${args+$$args }-DDEFAULT_KEY=$$key ;; \
+       esac && \
+       cd $(dir $@) && m4 -P $$args $(HERE)/$< >$@.new && \
+       mv $@.new $@
+DOTLINKS               += .gnupg/gpg-agent.conf
+.gnupg/gpg-agent.conf_SRC = gpg-agent.conf
+
 ## Random scripts.
 SCRIPTLINKS            += mdw-editor mdw-pager
 SCRIPTLINKS            += mdw-conf
@@ -348,12 +368,6 @@ endif
 
 ifeq ($(FIREFOX),t)
 
-out/:
-       $(call v_tag,MKDIR)mkdir $@
-
-out/firefox/: | out/
-       $(call v_tag,MKDIR)mkdir $@
-
 clean::; rm -rf out/
 
 all: out/firefox/smartup-gestures.config
@@ -377,8 +391,8 @@ all: $(addprefix $(HOME)/, $(MISCLINKS))
 misclink-ok-p           = \
        $(call symlink-ok-p,$(HOME)/$1,$(call misclink-source,$1))
 $(addprefix $(HOME)/, $(subst %,\%,$(MISCLINKS))): $(HOME)/%: \
-               $$(if $$(call misclink-ok-p,$$*),,_force)
-       $(call v_tag,SYMLINK)mkdir -p $(dir $@) && \
+               $$(if $$(call misclink-ok-p,$$*),,_force) | $$(dir $$@)
+       $(call v_tag,SYMLINK) \
                rm -f $@.new && \
                ln -s $(call misclink-source,$*) $@.new && \
                mv $@.new $@
@@ -394,8 +408,8 @@ dotlink-ok-p                 = \
        $(call symlink-ok-p,$(HOME)/$1,$(call dotfile-source,$1))
 all: $(addprefix $(HOME)/, $(DOTLINKS))
 $(addprefix $(HOME)/, $(subst %,\%,$(DOTLINKS))): $(HOME)/%: \
-               $$(if $$(call dotlink-ok-p,$$*),,_force)
-       $(call v_tag,SYMLINK)mkdir -p $(dir $@) && \
+               $$(if $$(call dotlink-ok-p,$$*),,_force) | $$(dir $$@)
+       $(call v_tag,SYMLINK) \
                rm -f $@.new && \
                ln -s $(call dotfile-source,$*) $@.new && \
                mv $@.new $@
@@ -404,8 +418,8 @@ $(addprefix $(HOME)/, $(subst %,\%,$(DOTLINKS))): $(HOME)/%: \
 ## Hack with the C preprocessor.
 all: $(addprefix $(HOME)/, $(DOTCPP))
 $(addprefix $(HOME)/, $(subst %,\%,$(DOTCPP))): $(HOME)/%: \
-               $$(call dotfile-source,$$*) Makefile
-       $(call v_tag,CPP)mkdir -p $(dir $@) && \
+               $$(call dotfile-source,$$*) Makefile | $$(dir $$@)
+       $(call v_tag,CPP) \
                rm -f $@.new && \
                cpp -P -o$@.new $($*_DEFS) $< && \
                mv $@.new $@
@@ -417,8 +431,8 @@ SUBSTS                      += $(call substvar,home,$(HOME))
 SUBSTS                 += $(call substvar,profile,$(HERE))
 all: $(addprefix $(HOME)/, $(DOTSUBST))
 $(addprefix $(HOME)/, $(subst %,\%,$(DOTSUBST))): $(HOME)/%: \
-               $$(call dotfile-source,$$*,.in) Makefile
-       $(call v_tag,SUBST)mkdir -p $(dir $@) && \
+               $$(call dotfile-source,$$*,.in) Makefile | $$(dir $$@)
+       $(call v_tag,SUBST) \
                rm -f $@.new && \
                sed -e "1i\
 $(relax)### generated by $(HERE)/Makefile; do not edit!" \
@@ -435,8 +449,8 @@ script-source                = $(HERE)/bin/$(or $($1_SRC), $1)
 ifeq ($(prefix-shebang-p),t)
 all: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS))
 $(addprefix $(HOME)/bin/, $(SCRIPTLINKS)): $(HOME)/bin/%: \
-               $$(call script-source,$$*) Makefile
-       $(call v_tag,SHEBANG)mkdir -p $(dir $@) && \
+               $$(call script-source,$$*) Makefile | $$(dir $$@)
+       $(call v_tag,SHEBANG) \
                rm -f $@.new && \
                sed "1s\a\(#! *\)/\a\1$(SHEBANG_PREFIX)/\a" \
                        $(call script-source,$*) >$@.new && \
@@ -448,8 +462,8 @@ scriptlink-ok-p              = \
        $(call symlink-ok-p,$(HOME)/bin/$1,$(call script-source,$1))
 all: $(addprefix $(HOME)/bin/, $(SCRIPTLINKS))
 $(addprefix $(HOME)/bin/, $(SCRIPTLINKS)): $(HOME)/bin/%: \
-               $$(if $$(call scriptlink-ok-p,$$*),,_force)
-       $(call v_tag,SYMLINK)mkdir -p $(dir $@) && \
+               $$(if $$(call scriptlink-ok-p,$$*),,_force) | $$(dir $$@)
+       $(call v_tag,SYMLINK) \
                rm -f $@.new && \
                ln -s $(call script-source,$*) $@.new && \
                mv $@.new $@
@@ -470,8 +484,8 @@ $(foreach p, $(PACKAGES), $(eval DEP_$p = $(if $(shell \
        if $($p_CHECK) >/dev/null 2>&1 --version; then echo t; fi),, \
        $(call pkg-stamp,$p,install))))
 
-$(PACKAGES:%=$(SRCDIR)/%.tar.gz): $(SRCDIR)/%.tar.gz:
-       $(call v_tag,FETCH)mkdir -p $(SRCDIR) && \
+$(PACKAGES:%=$(SRCDIR)/%.tar.gz): $(SRCDIR)/%.tar.gz: | $(SRCDIR)/
+       $(call v_tag,FETCH) \
                rm -f $@.new && \
                $(call get-url,$@.new,$(REPO)/$*.tar.gz) && \
                mv $@.new $@
diff --git a/dot/gpg-agent.conf b/dot/gpg-agent.conf
new file mode 100644 (file)
index 0000000..6f62172
--- /dev/null
@@ -0,0 +1,4 @@
+### -*-conf-*-
+### GnuPG agent configuration.
+
+allow-loopback-pinentry
diff --git a/dot/gpg.conf.m4 b/dot/gpg.conf.m4
new file mode 100644 (file)
index 0000000..22d464f
--- /dev/null
@@ -0,0 +1,70 @@
+m4_divert(-1)m4_dnl -*-m4-*-
+### GnuPG configuration.
+
+###--------------------------------------------------------------------------
+### Preliminaries.
+
+m4_changequote([:, :])
+
+###--------------------------------------------------------------------------
+### Metaconfiguration.
+
+m4_define([:PREFERRED_CIPHER:], [:TWOFISH:])
+m4_define([:OTHER_CIPHERS:], [:AES256 AES BLOWFISH 3DES CAST5:])
+
+m4_define([:PREFERRED_DIGEST:], [:SHA256:])
+m4_define([:OTHER_DIGESTS:], [:RIPEMD160 SHA1:])
+
+m4_define([:COMPRESSIONS:], [:ZLIB ZIP:])
+
+m4_sinclude([:gpg.local.m4:])
+
+###--------------------------------------------------------------------------
+### Header.
+
+m4_divert(0)m4_dnl
+### -*-conf-*-
+### GENERATED from gpg.conf.m4: DO NOT EDIT
+
+m4_divert(-1)m4_dnl
+###--------------------------------------------------------------------------
+### Main configuration.
+
+m4_divert(10)m4_dnl
+## Annoying copyright notice.
+no-greeting
+m4_divert(19)m4_dnl
+
+m4_divert(20)m4_dnl
+## Key servers.
+keyserver wwwkeys.uk.pgp.net
+keyserver wwwkeys.pgp.net
+keyserver wwwkeys.us.pgp.net
+keyserver keys.distorted.org.uk
+keyserver-options auto-key-retrieve
+m4_divert(29)m4_dnl
+
+m4_divert(30)m4_dnl
+m4_ifdef([:DEFAULT_KEY:], [:m4_dnl
+## Key selection.
+default-key DEFAULT_KEY
+
+:])m4_dnl
+m4_divert(40)m4_dnl
+## Algorithm selection.
+s2k-cipher-algo PREFERRED_CIPHER
+s2k-digest-algo PREFERRED_DIGEST
+personal-cipher-preferences PREFERRED_CIPHER OTHER_CIPHERS
+personal-digest-preferences PREFERRED_DIGEST OTHER_DIGESTS
+personal-compress-preferences COMPRESSIONS
+default-preference-list PREFERRED_CIPHER OTHER_CIPHERS PREFERRED_DIGEST OTHER_DIGESTS COMPRESSIONS
+m4_divert(49)m4_dnl
+
+m4_divert(50)m4_dnl
+## Agent parameters.
+use-agent
+pinentry-mode loopback
+m4_divert(59)m4_dnl
+
+m4_divert(99)m4_dnl
+###----- That's all, folks --------------------------------------------------