summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-04-10 15:15:26 -0700
committerLuke Smith <luke@lukesmith.xyz>2018-04-10 15:15:26 -0700
commit26adb70a248e2b028c043f0e4eecb161de50a98c (patch)
tree8c63dfcc0ef99046781a2ba9016f8cd19a27f11b
parent346e838672e86076aa5ef6fb4a79c7bc76797817 (diff)
tmpfile now unique now unique
-rwxr-xr-xmutt-wizard.sh15
1 files changed, 8 insertions, 7 deletions
diff --git a/mutt-wizard.sh b/mutt-wizard.sh
index ed487c9..b28ad1c 100755
--- a/mutt-wizard.sh
+++ b/mutt-wizard.sh
@@ -9,13 +9,14 @@ fi
muttdir="$HOME/.config/mutt/"
-createMailboxes() { rm -f /tmp/log /tmp/lognew
- offlineimap --info -a $1 2&> /tmp/log
- sed -n '/^Folderlist/,/^Folderlist/p' /tmp/log |
- grep "^ " | sed -e "s/\//./g;s/(.*//g;s/^ //g" > /tmp/lognew
- while read box; do mkdir -p "$HOME/.mail/$1/$box"; done </tmp/lognew ;}
-
-chooseSync() { (crontab -l && testSync) || dialog --msgbox "No cronjob manager detected. Please install one and return to enable automatic mailsyncing" 10 60 ;}
+createMailboxes() { \
+ tmpdir=$(mktemp -d)
+ offlineimap --info -a $1 2&> "$tmpdir"/log
+ sed -n '/^Folderlist/,/^Folderlist/p' "$tmpdir"/log |
+ grep "^ " | sed -e "s/\//./g;s/(.*//g;s/^ //g" > "$tmpdir"/lognew
+ while read box; do mkdir -p "$HOME/.mail/$1/$box"; done <"$tmpdir"/lognew ;}
+
+chooseSync() { (cat /var/run/crond.pid && testSync) || dialog --msgbox "No cronjob manager detected. Please install one and return to enable automatic mailsyncing" 10 60 ;}
testSync() { (crontab -l | grep .config/mutt/etc/mailsync && removeSync) || addSync ;}
addSync() { min=$(dialog --inputbox "How many minutes should be between mail syncs?" 8 60 3>&1 1>&2 2>&3 3>&-)