update_config.py
branchv0.6.x
changeset 264 04fea4d8b900
parent 229 0fb2f12648a7
child 270 d3389645a91d
equal deleted inserted replaced
263:07fdc93dde9f 264:04fea4d8b900
    65     ds, do = dst.split('.')
    65     ds, do = dst.split('.')
    66     if not cp.has_option(ds, do):
    66     if not cp.has_option(ds, do):
    67         cp.set(ds, do, val)
    67         cp.set(ds, do, val)
    68         sect_opt.append((dst, 'N'))
    68         sect_opt.append((dst, 'N'))
    69 
    69 
       
    70 
       
    71 def set_dovecot_version(cp):
       
    72     if len(os.sys.argv) > 1:
       
    73         dovecot_version = os.sys.argv[1].strip()
       
    74         if not dovecot_version:
       
    75             dovecot_version = '1.2.11'
       
    76     else:
       
    77         dovecot_version = '1.2.11'
       
    78     cp.set('misc', 'dovecot_version', dovecot_version)
       
    79     sect_opt.append(('misc.dovecot_version', 'M'))
       
    80 
       
    81 
    70 def get_option(cp, src):
    82 def get_option(cp, src):
    71     ss, so = src.split('.')
    83     ss, so = src.split('.')
    72     return cp.get(ss, so)
    84     return cp.get(ss, so)
    73 
    85 
    74 def upd_052(cp):
    86 def upd_052(cp):
    93                      ('misc.forcedel',     'domain.force_deletion'),
   105                      ('misc.forcedel',     'domain.force_deletion'),
    94                      ('misc.passwdscheme', 'misc.password_scheme'),
   106                      ('misc.passwdscheme', 'misc.password_scheme'),
    95                      ('misc.dovecotvers',  'misc.dovecot_version')):
   107                      ('misc.dovecotvers',  'misc.dovecot_version')):
    96         move_option(cp, src, dst)
   108         move_option(cp, src, dst)
    97     cp.remove_section('maildir')
   109     cp.remove_section('maildir')
       
   110     set_dovecot_version(cp)
       
   111 
    98 
   112 
    99 # def main():
   113 # def main():
   100 if __name__ == '__main__':
   114 if __name__ == '__main__':
   101     sect_opt = []
   115     sect_opt = []
   102     had_config = False
   116     had_config = False
   106     if len(sect_opt):
   120     if len(sect_opt):
   107         had_config = False
   121         had_config = False
   108         update_cfg_file(cp, cf)
   122         update_cfg_file(cp, cf)
   109         sect_opt.sort()
   123         sect_opt.sort()
   110         print 'Please have a look at your configuration: %s' %cf
   124         print 'Please have a look at your configuration: %s' %cf
   111         print 'This are your Renamed/New settings:'
   125         print 'This are your Modified/Renamed/New settings:'
   112         for s_o, st in sect_opt:
   126         for s_o, st in sect_opt:
   113             print '%s   %s = %s' % (st, s_o, get_option(cp, s_o))
   127             print '%s   %s = %s' % (st, s_o, get_option(cp, s_o))
   114     if had_config:
   128     if had_config:
   115         update_cfg_file(cp, cf)
   129         update_cfg_file(cp, cf)
   116         print 'Removed section "config" with option "done" (obsolte)'
   130         print 'Removed section "config" with option "done" (obsolte)'