commit cd9cb18305e5c255cc7f9d096335245fd49c5e3d
parent 7d49693df9c024e1e125ce1948811f465082cc90
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Thu, 25 Feb 2016 10:54:30 -0800
allow for differing user names
Diffstat:
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/.msmtprc b/.msmtprc
@@ -1,5 +1,5 @@
syslog LOG_MAIL
-logfile /Users/adamsgaard/.msmtp.log
+logfile ~/.msmtp.log
account riseup
host mail.riseup.net
@@ -10,7 +10,7 @@ from andersd@riseup.net
tls on
tls_certcheck on
-tls_trust_file /Users/adamsgaard/.mutt/ca-certificates.crt
+tls_trust_file ~/.mutt/ca-certificates.crt
account geomail
host asmtp.au.dk
@@ -21,7 +21,7 @@ from anders.damsgaard@geo.au.dk
tls on
tls_certcheck on
-tls_trust_file /Users/adamsgaard/.mutt/ca-certificates.crt
+tls_trust_file ~/.mutt/ca-certificates.crt
account ucsd
host smtp.ucsd.edu
@@ -32,7 +32,7 @@ from adamsgaard@mail.ucsd.edu
tls on
tls_certcheck on
-tls_trust_file /Users/adamsgaard/.mutt/ca-certificates.crt
+tls_trust_file ~/.mutt/ca-certificates.crt
tls_starttls off
@@ -44,5 +44,5 @@ auth on
from andersdc@gmail.com
user andersdc@gmail.com
tls on
-tls_trust_file /Users/adamsgaard/.mutt/ca-certificates.crt
+tls_trust_file ~/.mutt/ca-certificates.crt
diff --git a/.mutt/offlineimap.py b/.mutt/offlineimap.py
@@ -1,9 +1,12 @@
#!/usr/bin/python
import re
import subprocess
+import getpass
+import os
-user='adamsgaard'
+user = getpass.getuser()
+home = os.getenv('HOME')
def get_keychain_pass(account=None, server=None):
params = {
@@ -11,7 +14,7 @@ def get_keychain_pass(account=None, server=None):
'command': 'find-internet-password',
'account': account,
'server': server,
- 'keychain': '/Users/' + user + '/Library/Keychains/login.keychain',
+ 'keychain': home + '/Library/Keychains/login.keychain',
}
command = "sudo -u " + user + " %(security)s -v %(command)s -g -a %(account)s -s %(server)s %(keychain)s" % params
output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)