2021-03-16 12:10:07 +01:00
|
|
|
#!/bin/sh
|
|
|
|
export USER="$(whoami)"
|
|
|
|
export HOME=/home/"$USER"
|
|
|
|
export DISPLAY=":0"
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# check for internet connection
|
|
|
|
ip route ls | grep -q '.'
|
|
|
|
|
|
|
|
# check if the gpg-agent is running
|
|
|
|
pgrep gpg-agent > /dev/null
|
|
|
|
|
|
|
|
# Find new messages in feeds
|
|
|
|
d="$(mktemp -d)"
|
2021-03-17 09:59:47 +01:00
|
|
|
trap "rm -rf '$d'" EXIT KILL
|
2021-03-16 12:10:07 +01:00
|
|
|
mmkdir "$d"
|
|
|
|
sfeed_update > /dev/null 2>&1
|
|
|
|
sfeed_mbox ~/.sfeed/feeds/* | mdeliver -M -v "$d" | while read mail; do
|
|
|
|
if ! mlist /data/mail/feeds | magrep -q message-id:"$(mshow -qh message-id "$mail" | cut -d' ' -f2)"; then
|
2021-03-17 09:59:47 +01:00
|
|
|
mdeliver /data/mail/feeds < "$mail" > /dev/null
|
2021-03-16 12:10:07 +01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
rm -rf "$d"
|
|
|
|
|
|
|
|
exec sleep 1h
|