From 28b54d9a8811d378f547f084ee705d195b3c499c Mon Sep 17 00:00:00 2001 From: Yifei Zhan Date: Sun, 25 Jul 2021 01:45:16 +0000 Subject: [PATCH] compatibility: replace pidof with pgrep, set GPG_TTY to $(tty) --- bin/mailsync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index f00baf1..864b81d 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -14,7 +14,7 @@ # Run only if user logged in (prevent cron errors) pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance -pidof mbsync >/dev/null && { echo "mbsync is already running."; exit ;} +pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} # First, we have to get the right variables for the mbsync file, the pass # archive, notmuch and the GPG home. This is done by searching common profile @@ -25,7 +25,7 @@ eval "$(grep -h -- \ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" -export GPG_TTY=$TTY +export GPG_TTY="$(tty)" [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc"