Index: setup.sh ================================================================== --- setup.sh +++ setup.sh @@ -22,17 +22,27 @@ echo "Setting global fossil settingsā€¦" 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 ../ if have gpg || have gpg2; then mkdir -p $HOME/.local/share/gnupg