aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-02-05 16:01:49 -0500
committerJesse Luehrs <doy@tozt.net>2022-02-07 19:03:14 -0500
commite41f066e1002340f2df515becf8c310298e4c312 (patch)
tree5d5d4514b103cdb5db56548d63b76e34c5a31c42
parent97ba7df82d874cfe2d32efe0bd2b8bceaa9c43dd (diff)
downloadmbsyncloop-e41f066e1002340f2df515becf8c310298e4c312.tar.gz
mbsyncloop-e41f066e1002340f2df515becf8c310298e4c312.zip
refactor
-rwxr-xr-xmbsyncloop10
1 files changed, 7 insertions, 3 deletions
diff --git a/mbsyncloop b/mbsyncloop
index 967053c..cb77303 100755
--- a/mbsyncloop
+++ b/mbsyncloop
@@ -5,12 +5,16 @@ use warnings;
use POSIX 'mkfifo';
-my $pw = `rbw get mail.tozt.net doy\@tozt.net`;
+my $password_command = "rbw get mail.tozt.net doy\@tozt.net";
+my $mbsync_config = "~/.mbsyncloop";
+my $goimapnotify_config = "~/.config/imapnotify/tozt.conf";
+
+my $pw = `$password_command`;
if ($?) {
die "failed to fetch password: command returned $?";
}
-open my $goimapnotify, '-|', "sh", "-c", "while true; do goimapnotify --conf ~/.config/imapnotify/tozt.conf 2>&1; done" or die "couldn't run goimapnotify: $!";
+open my $goimapnotify, '-|', "sh", "-c", "while true; do goimapnotify --conf '$goimapnotify_config' 2>&1; done" or die "couldn't run goimapnotify: $!";
my ($pw_pipe, $pid);
@@ -52,7 +56,7 @@ while (1) {
sub sync {
my ($channel) = @_;
while (1) {
- my $status = system("mbsync -c ~/.mbsyncloop $channel");
+ my $status = system("mbsync -c '$mbsync_config' $channel");
if (!$status) {
system("notmuch new | grep -v '^No new mail\.\$'");
last;