aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfig/offlineimap/config3
-rw-r--r--config/offlineimap/plugin.py5
-rwxr-xr-xinstall2
-rwxr-xr-xlocal/bin/netsync49
m---------private0
-rw-r--r--profile2
6 files changed, 57 insertions, 4 deletions
diff --git a/config/offlineimap/config b/config/offlineimap/config
index 6853963..d3bc247 100755
--- a/config/offlineimap/config
+++ b/config/offlineimap/config
@@ -2,11 +2,13 @@
[general]
accounts = email
maxsyncaccounts = 4
+pythonfile = ~/.config/offlineimap/plugin.py
[Repository email-remote]
type = IMAP
remotehost = imap.seznam.cz
remoteuser = cynerd@email.cz
+remotepasseval = get_pass("cynerd@email.cz")
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
@@ -17,6 +19,5 @@ localfolders = ~/.mail/email
[Account email]
localrepository = email-local
remoterepository = email-remote
-autorefresh = 1
postsynchook = ~/.local/sbin/newmail-notify
diff --git a/config/offlineimap/plugin.py b/config/offlineimap/plugin.py
new file mode 100644
index 0000000..4366979
--- /dev/null
+++ b/config/offlineimap/plugin.py
@@ -0,0 +1,5 @@
+#! /usr/bin/env python2
+from subprocess import check_output
+
+def get_pass(account):
+ return check_output(["pass", "mail/" + account]).splitlines()[0]
diff --git a/install b/install
index cc7e8c3..943cee4 100755
--- a/install
+++ b/install
@@ -59,8 +59,8 @@ if ask "Install email synchronization"; then
inst local/sbin/newmail-notify ~/.local/sbin/newmail-notify
inst_email_sync
# Contains:
- # inst local/sbin/syncemail ~/.local/sbin/
# inst config/offlineimap/ ~/.config/offlineimap
+ inst config/offlineimap/plugin.py ~/.config/offlineimap/plugin.py
fi
if ask "Install mutt configuration"; then
diff --git a/local/bin/netsync b/local/bin/netsync
new file mode 100755
index 0000000..b571e6e
--- /dev/null
+++ b/local/bin/netsync
@@ -0,0 +1,49 @@
+#!/bin/sh
+set -e
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h|--help)
+ echo "Usage: netsync [OPTION].."
+ echo "Group network synchronization script."
+ echo
+ echo "Options:"
+ echo " -h, --help"
+ echo " Print this help text."
+ echo " --tty"
+ echo " Spawn its own terminal window to run in"
+ exit 0
+ ;;
+ --tty)
+ # TODO dump log somewhere with timestamp
+ nohup urxvt -title "Network Sync" -e "$0" 2>&1 >/dev/null &
+ # TODO we might have to do some trickary here if we want more than
+ # just this one option.
+ exit 0
+ ;;
+ *)
+ echo "Unknown argument: $1" >&2
+ exit 1
+ esac
+ shift
+done
+
+EXIT_CODE=0
+
+run() {
+ if ! "$@"; then
+ EXIT_CODE=$?
+ echo -e "\e[1'31mCommand exited with: $EXIT_CODE\e[0m"
+ return $EXIT_CODE
+ fi
+}
+
+echo -e "\e[1;34m========== DAV discover ==========\e[0m"
+vdirsyncer discover
+echo -e "\e[1;34m========== DAV sync ==========\e[0m"
+vdirsyncer sync
+
+echo -e "\e[1;34m========== Mail ==========\e[0m"
+offlineimap
+
+# TODO also send mails now if there are some delayed mails (also confirm first?)
diff --git a/private b/private
-Subproject 98f3203b2b5d889be18508e6d355f6efde54759
+Subproject 7af7405e65440a666cbe6468b415546bfc20d20
diff --git a/profile b/profile
index 76a201c..1ce3c70 100644
--- a/profile
+++ b/profile
@@ -7,8 +7,6 @@ export EDITOR=vim
# Start music player daemon
~/.service/mpd -q status || ~/.service/mpd start
-# Start email synchronization
-~/.local/sbin/syncemail
# Start syncthing
~/.service/syncthing -q status || ~/.service/syncthing start