~xubuntu-dev/ubiquity/lp1437180_feh

« back to all changes in this revision

Viewing changes to bin/ubiquity-dm

  • Committer: Evan Dandrea
  • Date: 2010-03-05 22:44:34 UTC
  • Revision ID: evan.dandrea@canonical.com-20100305224434-lij2je37ii2iiw53
Restore Colin's set_locale function.  However, this is only half the
puzzle.  We need to finish running the language component when the
exit button is pressed when in greeter mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
background = '/usr/share/backgrounds/warty-final-ubuntu.png'
21
21
 
 
22
def set_locale():
 
23
    from ubiquity.debconfcommunicator import DebconfCommunicator
 
24
    import debconf
 
25
 
 
26
    db = DebconfCommunicator('ubiquity', cloexec=True)
 
27
    locale = ''
 
28
    try:
 
29
        locale = db.get('debian-installer/locale')
 
30
    except debconf.DebconfError:
 
31
        pass
 
32
    
 
33
    if not locale:
 
34
        db.shutdown()
 
35
        return
 
36
 
 
37
    db.shutdown()
 
38
 
 
39
    default_locale = open('/etc/default/locale', 'w')
 
40
    print >>default_locale, 'LANG="%s"' % locale
 
41
    default_locale.close()
 
42
 
 
43
    environment = open('/etc/environment')
 
44
    environment_lines = environment.readlines()
 
45
    environment.close()
 
46
    environment = open('/etc/environment', 'w')
 
47
    seen_lang = False
 
48
    for line in environment_lines:
 
49
        if line.startswith('LANG='):
 
50
            print >>environment, 'LANG="%s"' % locale
 
51
            seen_lang = True
 
52
        else:
 
53
            print >>environment, line.rstrip('\n')
 
54
    if not seen_lang:
 
55
        print >>environment, 'LANG="%s"' % locale
 
56
    environment.close()
 
57
 
 
58
    locale_gen = open('/etc/locale.gen', 'w')
 
59
    print >>locale_gen, '%s UTF-8' % locale
 
60
    locale_gen.close()
 
61
 
 
62
    subprocess.call(['/usr/sbin/locale-gen', locale])
 
63
 
22
64
class XStartupError(EnvironmentError):
23
65
    pass
24
66
 
343
385
elif dm.frontend == 'kde_ui':
344
386
    proc = ['/etc/init.d/kdm', 'start']
345
387
ret = dm.run(*sys.argv[4:])
 
388
if ret == 0:
 
389
    set_locale()
346
390
if proc:
347
391
    subprocess.Popen(proc)
348
392
sys.exit(ret)