From 79ca5807f41c30205e35677f01d4f2e99a4f467c Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Mon, 31 Aug 2020 20:22:19 +0000 Subject: [PATCH] Only set up Fossil checkin signing when key exists --- setup.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index efa7f0e..0dcbc8f 100755 --- a/setup.sh +++ b/setup.sh @@ -24,13 +24,23 @@ if have fossil; then fossil set --global autosync 0 fossil set --global editor 'vim -c "se ft=gitcommit"' fossil set --global mv-rm-files 1 - gpg_args="-u 35E1AF8B --clearsign -o" + if have gpg2; then - fossil set --global clearsign 1 - fossil set --global pgp-command "gpg2 $gpg_args" + gpg="gpg2" elif have gpg; then + gpg="gpg" + else + gpg=":" + fi + + gpg_key="35E1AF8B" + if test $($gpg -a --export $gpg_key 2>/dev/null | wc -c) -gt 0; then + fossil set --global pgp-command \ + "$gpg -u $gpg_key --clearsign -o" fossil set --global clearsign 1 - fossil set --global pgp-command "gpg $gpg_args" + else + fossil unset --global pgp-command + fossil unset --global clearsign fi fi have git && link_file git .config/git ../