Skip to content

Commit

Permalink
Merge pull request #976 from ivan-boikov/master
Browse files Browse the repository at this point in the history
No mailsync with locked GPG key in non-interactive shells
  • Loading branch information
LukeSmithxyz authored Feb 28, 2025
2 parents 5300aa7 + f8ffab3 commit 213afe1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/mailsync
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ eval "$(grep -h -- \
"$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \
"$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)"

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

0 comments on commit 213afe1

Please sign in to comment.