Browse Source

No mailsync with locked GPG key in non-interactive shells

pull/976/head
ivan-boikov 11 months ago
parent
commit
f8ffab3a11
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      bin/mailsync

+ 3
- 0
bin/mailsync View File

@@ -24,6 +24,9 @@ eval "$(grep -h -- \
"$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ "$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \
"$HOME/.pam_environment" 2>/dev/null)" "$HOME/.pam_environment" 2>/dev/null)"


# For non-interactive shell (e.g. cron job) run only when the GPG key (in $GNUPGHOME or pass --homedir) is unlocked
tty -s || (echo "dummy" | gpg --sign --batch --pinentry-mode error -o /dev/null > /dev/null 2>&1) || exit

export GPG_TTY="$(tty)" export GPG_TTY="$(tty)"


[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc"


Loading…
Cancel
Save