Changeset View
Changeset View
Standalone View
Standalone View
pykolab/setup/setup_mta.py
Show First 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | if not os.path.isfile('/etc/postfix/main.cf'): | ||||
shutil.copy( | shutil.copy( | ||||
'/usr/share/postfix/main.cf.debian', | '/usr/share/postfix/main.cf.debian', | ||||
'/etc/postfix/main.cf' | '/etc/postfix/main.cf' | ||||
) | ) | ||||
if not os.path.isdir('/etc/postfix/ldap'): | if not os.path.isdir('/etc/postfix/ldap'): | ||||
os.mkdir('/etc/postfix/ldap/', 0o770) | os.mkdir('/etc/postfix/ldap/', 0o770) | ||||
for filename in files.keys(): | for filename in files: | ||||
fp = open(filename, 'w') | fp = open(filename, 'w') | ||||
fp.write(files[filename]) | fp.write(files[filename]) | ||||
fp.close() | fp.close() | ||||
fp = open('/etc/postfix/transport', 'a') | fp = open('/etc/postfix/transport', 'a') | ||||
fp.write("\n# Shared Folder Delivery for %(domain)s:\nshared@%(domain)s\t\tlmtp:unix:/var/lib/imap/socket/lmtp\n" % {'domain': conf.get('kolab', 'primary_domain')}) | fp.write("\n# Shared Folder Delivery for %(domain)s:\nshared@%(domain)s\t\tlmtp:unix:/var/lib/imap/socket/lmtp\n" % {'domain': conf.get('kolab', 'primary_domain')}) | ||||
fp.close() | fp.close() | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | for hc_file in [ 'inbound', 'internal', 'submission' ]: | ||||
shutil.copy(input_file, "/etc/postfix/header_checks.%s" % (hc_file)) | shutil.copy(input_file, "/etc/postfix/header_checks.%s" % (hc_file)) | ||||
subprocess.call(["postmap", "/etc/postfix/header_checks.%s" % (hc_file)]) | subprocess.call(["postmap", "/etc/postfix/header_checks.%s" % (hc_file)]) | ||||
myaugeas = Augeas() | myaugeas = Augeas() | ||||
setting_base = '/files/etc/postfix/main.cf/' | setting_base = '/files/etc/postfix/main.cf/' | ||||
for setting_key in postfix_main_settings.keys(): | for setting_key in postfix_main_settings: | ||||
setting = os.path.join(setting_base,setting_key) | setting = os.path.join(setting_base,setting_key) | ||||
current_value = myaugeas.get(setting) | current_value = myaugeas.get(setting) | ||||
if current_value == None: | if current_value == None: | ||||
try: | try: | ||||
myaugeas.set(setting, postfix_main_settings[setting_key]) | myaugeas.set(setting, postfix_main_settings[setting_key]) | ||||
except: | except: | ||||
insert_paths = myaugeas.match('/files/etc/postfix/main.cf/*') | insert_paths = myaugeas.match('/files/etc/postfix/main.cf/*') | ||||
▲ Show 20 Lines • Show All 224 Lines • Show Last 20 Lines |