blob: 95deb7e94a79ea1d6c64f5ad35eaa768250f7672 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/usr/bin/python2
# This starts offlineimap, but first it requests passwords from pass by user
# notification launching script at front.
import os
import sys
import subprocess
from offlineimap import OfflineImap
frontscript = """
echo "Asking for gpg password to access pass" 1>&2
pass mail/cynerd@email.cz
echo "All done" 1>&2
"""
annoyme = [
os.path.expanduser("~/.local/sbin/annoyme-request"),
"syncemail",
"Imap email synchronization service password request."
]
anproc = subprocess.Popen(annoyme, stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
anproc.stdin.write(frontscript)
anproc.stdin.close()
output = anproc.stdout.read().splitlines()
excode = anproc.wait()
if excode != 0:
print("Authentication failed. Please start emailsync again")
sys.exit(1)
print(output)
sys.argv.append('-k')
sys.argv.append('Repository_email-remote:remotepass=' + output[0])
OfflineImap().run()
|