update_config_0.4.x-0.5.py
changeset 86 e43e4e7e9ec0
parent 68 7ae95b9938c4
equal deleted inserted replaced
85:6f2fa633f1a1 86:e43e4e7e9ec0
     2 # -*- coding: UTF-8 -*-
     2 # -*- coding: UTF-8 -*-
     3 # Copyright 2008 VEB IT
     3 # Copyright 2008 VEB IT
     4 # See COPYING for distribution information.
     4 # See COPYING for distribution information.
     5 # $Id$
     5 # $Id$
     6 
     6 
       
     7 import sys
     7 from ConfigParser import ConfigParser
     8 from ConfigParser import ConfigParser
     8 from shutil import copy2
     9 from shutil import copy2
     9 
    10 
    10 cf = '/usr/local/etc/vmm.cfg'
    11 cf = '/usr/local/etc/vmm.cfg'
    11 fh = file(cf, 'r')
    12 fh = file(cf, 'r')
    27         cp.set('maildir', 'folders', 'Drafts:Sent:Templates:Trash')
    28         cp.set('maildir', 'folders', 'Drafts:Sent:Templates:Trash')
    28     if cp.has_option('maildir', 'folder'):
    29     if cp.has_option('maildir', 'folder'):
    29         cp.remove_option('maildir', 'folder')
    30         cp.remove_option('maildir', 'folder')
    30     cp.write(fh)
    31     cp.write(fh)
    31     fh.close()
    32     fh.close()
       
    33 
       
    34 if not cp.has_option('bin', 'postconf'):
       
    35     fh = file(cf, 'w')
       
    36     try:
       
    37         postconf = sys.argv[1].strip()
       
    38         if len(postconf):
       
    39             cp.set('bin', 'postconf', postconf)
       
    40         else: # possible?
       
    41             cp.set('bin', 'postconf', '/usr/sbin/postconf')
       
    42     except IndexError:
       
    43         cp.set('bin', 'postconf', '/usr/sbin/postconf')
       
    44     cp.write(fh)
       
    45     fh.close()
       
    46     print
       
    47     print "Please have a look at your %s" %cf
       
    48     print "and verify the value from option 'postconf' in section 'bin'."
       
    49     print
       
    50