jaromail

a commandline tool to easily and privately handle your e-mail
git clone git://parazyd.org/jaromail.git
Log | Files | Refs | Submodules | README

commit bd58e6a52609fa764168bde27b85c04cdc255ebd
parent 6f59b5e2a7f70b07492562fa5b543625bde9dcfb
Author: parazyd <parazyd@dyne.org>
Date:   Thu, 23 Mar 2017 13:07:05 +0100

fix opmux; fix pass bug where it reencrypts everything on every update

also enable static building of bins on musl, and switch to busybox netcat

Diffstat:
MMakefile | 2+-
Mbuild/build-gnu.sh | 1+
Msrc/jaro | 4++--
Msrc/zlibs/filters | 2+-
Msrc/zlibs/helpers | 2+-
Msrc/zlibs/mutt | 15++++++++-------
6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile @@ -6,7 +6,7 @@ install: clean: rm -f src/*.o - rm -f src/pgpewrap + rm -f src/gpgewrap rm -f src/fetchaddr rm -f src/parsedate rm -f src/dotlock diff --git a/build/build-gnu.sh b/build/build-gnu.sh @@ -5,6 +5,7 @@ distro=unknown builddir=`pwd` # cc="${builddir}/cc-static.zsh" cc="gcc -O3" +[[ "$OSTYPE" = linux-musl ]] && cc="gcc -Os -static" which apt-get > /dev/null && distro=debian which yum > /dev/null && distro=fedora diff --git a/src/jaro b/src/jaro @@ -346,7 +346,7 @@ check_bin() { # check for pass, else fallback if isfound pass; then act "keyring in use: pass (auto-detected)" - export PASSWORD_STORE_DIR=$HOME/.password-store + export PASSWORD_STORE_DIR=${PASSWORD_STORE_DIR:-$HOME/.password-store} [[ -d $PASSWORD_STORE_DIR ]] || { error "the 'pass' keyring is found but not initialised" error "run 'pass init your-gpg-id' or uninstall it to use other keyrings" @@ -371,7 +371,7 @@ check_bin() { case $JARO_KEYRING in pass) act "keyring in use: pass (set in JARO_KEYRING)" - export PASSWORD_STORE_DIR=$HOME/.password-store + export PASSWORD_STORE_DIR=${PASSWORD_STORE_DIR:-$HOME/.password-store} [[ -d $PASSWORD_STORE_DIR ]] || { error "the 'pass' keyring is found but not initialised" error "run 'pass init your-gpg-id'" diff --git a/src/zlibs/filters b/src/zlibs/filters @@ -56,7 +56,7 @@ init_inbox() { if [[ $PASS = 1 ]]; then GPGID=${$(awk '/default-key/ { print $2 }' $HOME/.gnupg/gpg.conf)} - pass init ${GPGID} + [[ -f "$PASSWORD_STORE_DIR/.gpg-id" ]] || pass init ${GPGID} fi ${=mkdir} "$MAILDIRS/cache" ${=mkdir} "$MAILDIRS/logs" diff --git a/src/zlibs/helpers b/src/zlibs/helpers @@ -263,7 +263,7 @@ is_online() { ;; host) func "trying to connect ${_host} port ${_port}" - nc -w 16 -z ${_host} ${_port} > /dev/null + busybox nc -w 16 -z ${_host} ${_port} > /dev/null { test $? = 0 } || { error "Host unreachable: $_host" act "Network connection is checked with 16s timeout" diff --git a/src/zlibs/mutt b/src/zlibs/mutt @@ -59,7 +59,7 @@ x_mutt() { gpgkey="" - [[ -f $MAILDIRS/.pass/.gpg-id ]] || { + [[ -f ${PASSWORD_STORE_DIR}/.gpg-id ]] || { # detect the default gpg key to always encrypt also to self # update: do not re-encrypt if already done [[ -r $HOME/.gnupg/gpg.conf ]] && { @@ -126,22 +126,23 @@ EOF # Generated by JaroMail at every execution set pgp_long_ids -set pgp_decode_command="OPMUX_MUA=mutt ${opmux_path} --passphrase-fd 0 \ +set pgp_decode_command="OPMUX_MUA=mutt ${cryptowrap} --passphrase-fd 0 \ --quiet --batch --output - %f" -set pgp_verify_command="OPMUX_MUA=mutt ${opmux_path} --quiet --batch \ +set pgp_verify_command="OPMUX_MUA=mutt ${cryptowrap} --quiet --batch \ --output - --verify %s %f" -set pgp_decrypt_command="OPMUX_MUA=mutt ${opmux_path} --passphrase-fd 0 \ +set pgp_decrypt_command="OPMUX_MUA=mutt ${cryptowrap} --passphrase-fd 0 \ --quiet --batch --output - %f" -set pgp_encrypt_only_command="${opmux_path} --batch --quiet --output - \ +set pgp_encrypt_only_command="${cryptowrap} --batch --quiet --output - \ --encrypt --textmode --armor --always-trust -r '%r' %f" -set pgp_encrypt_sign_command="${opmux_path} --passphrase-fd 0 --batch \ +set pgp_encrypt_sign_command="${cryptowrap} --passphrase-fd 0 --batch \ --quiet --textmode --output - --encrypt --sign %?a?-u %a? --armor \ --always-trust -r '%r' %f" -set pgp_list_pubring_command="${opmux_path} --batch --quiet --with-colons \ +set pgp_list_pubring_command="${cryptowrap} --batch --quiet --with-colons \ --list-keys %r" +## XXX: currently added in Identity.txt # set pgp_decryption_okay="^opmux: SUCCESS\.$" EOF ;;