summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2021-01-01 08:11:14 -0500
committerLuke Smith <luke@lukesmith.xyz>2021-01-01 08:11:14 -0500
commitaa4fb999ebbe6e99ac5e083be372b3630354c8bc (patch)
tree93b9ce306cdeba49c1827b045f7a1257d9cbbe01 /bin
parentf589cd4dfdd00f8521c09548b77cba6f995f89a5 (diff)
systemd fix, check for variables with whitespace
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mailsync12
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/mailsync b/bin/mailsync
index 02e4f98..1d676b8 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -20,17 +20,17 @@ pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;}
# archive, notmuch and the GPG home. This is done by searching common profile
# files for variable assignments. This is ugly, but there are few options that
# will work on the maximum number of machines.
-eval `grep -h -- \
- "^\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \
- "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.pam_environment" 2>/dev/null`
+eval "$(grep -h -- \
+ "^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \
+ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.pam_environment" 2>/dev/null)"
# One alternative to this kind of command would be marking the script for
# /bin/sh -l. That might cause other problems on other particular setups that
# do more complicated things on login, or those people who assign environmental
# variables in shell rc files.
-# This variable might be required for soysdemd users, but it will break the
-# script on Artix runit.
-# export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
+case "$(readlink -f /sbin/init)" in
+ *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
+esac
export GPG_TTY=$TTY
[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc"