~xubuntu-dev/ubiquity/lp1437180_feh

« back to all changes in this revision

Viewing changes to bin/ubiquity-dm

  • Committer: Colin Watson
  • Date: 2012-04-30 23:38:41 UTC
  • mfrom: (5402 trunk)
  • mto: This revision was merged to the branch mainline in revision 5403.
  • Revision ID: cjwatson@canonical.com-20120430233841-xb0qsk46lnhski7m
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
import errno
11
11
import imp
12
12
import grp
 
13
import pwd
13
14
 
14
15
import debconf
15
16
 
16
17
sys.path.insert(0, '/usr/lib/ubiquity')
17
18
 
18
19
import ubiquity.frontend
19
 
import pwd
20
 
 
21
20
from ubiquity import osextras
22
21
from ubiquity import gsettings
 
22
from ubiquity import gconftool
23
23
from ubiquity.misc import create_bool
24
24
from ubiquity.casper import get_casper
25
25
from ubiquity.debconfcommunicator import DebconfCommunicator
158
158
        signal.signal(signal.SIGUSR1, signal.SIG_IGN)
159
159
 
160
160
    def run(self, *program):
 
161
        extras = []
161
162
        null = open('/dev/null', 'w')
162
163
        try:
163
164
            os.makedirs('/var/log/installer')
188
189
 
189
190
        servercommand.extend([self.vt, self.display])
190
191
 
191
 
        for attempt in ('main', 'failsafe'):
 
192
        for attempt in ('main', 'fbdev', 'vesa'):
192
193
            command = list(servercommand)
193
194
            if attempt == 'main' and self.force_failsafe:
194
195
                continue
195
 
            elif attempt == 'failsafe':
 
196
            elif attempt != 'main':
196
197
                # TODO cjwatson 2010-02-11: This is a bodge.  The
197
198
                # duplication is nasty, but fortunately bullet-proof X
198
199
                # actually turns out not to be very complicated nowadays.
202
203
                # is working on doing that, but is blocked on a couple of
203
204
                # Upstart bugs; once all that's resolved, we should back
204
205
                # this out.
205
 
                if os.path.exists('/dev/fb0'):
206
 
                    driver = 'fbdev'
207
 
                else:
208
 
                    driver = 'vesa'
 
206
                if attempt == 'fbdev' and not os.path.exists('/dev/fb0'):
 
207
                    continue
209
208
                xorg_conf_failsafe = '/etc/X11/xorg.conf.failsafe'
210
209
                command.extend(['-config', xorg_conf_failsafe])
211
 
                command.extend(['-logfile', '/var/log/Xorg.failsafe.log'])
 
210
                command.extend(['-logfile', '/var/log/Xorg.%s.log' % attempt])
212
211
 
213
 
                if not os.path.exists(xorg_conf_failsafe):
214
 
                    xorg_conf_failsafe_file = open(xorg_conf_failsafe, 'w')
215
 
                    print('''\
 
212
                xorg_conf_failsafe_file = open(xorg_conf_failsafe, 'w')
 
213
                print('''\
216
214
Section "Device"
217
215
        Identifier      "Configured Video Device"
218
216
        Driver          "%s"
227
225
        Monitor         "Configured Monitor"
228
226
        Device          "Configured Video Device"
229
227
EndSection
230
 
''' % driver, file=xorg_conf_failsafe_file)
231
 
                    xorg_conf_failsafe_file.close()
 
228
''' % attempt, file=xorg_conf_failsafe_file)
 
229
                xorg_conf_failsafe_file.close()
232
230
 
233
231
            server = subprocess.Popen(
234
232
                command, stdin=null, stdout=logfile, stderr=logfile,
255
253
                if plymouth_running:
256
254
                    subprocess.call(['plymouth', 'quit', '--retain-splash'])
257
255
            except XStartupError:
258
 
                if attempt == 'failsafe':
 
256
                if attempt == 'vesa':
259
257
                    raise
260
258
 
261
259
            if self.server_started:
286
284
            dbus_subp.stdout.close()
287
285
            dbus_subp.wait()
288
286
 
 
287
        # dconf writer
 
288
        if os.path.exists("/usr/lib/dconf/dconf-service"):
 
289
            extras.append(subprocess.Popen(
 
290
                ['/usr/lib/dconf/dconf-service'],
 
291
                stdin=null, stdout=logfile, stderr=logfile,
 
292
                preexec_fn=self.drop_privileges))
 
293
 
289
294
        gconfd_running = False
290
295
        if (self.frontend == 'gtk_ui' and
291
296
            osextras.find_on_path('gconftool-2')):
294
299
                            preexec_fn=self.drop_privileges)
295
300
            gconfd_running = True
296
301
 
297
 
        extras = []
 
302
            # Enable compositing in metacity (not default upstream yet)
 
303
            gconftool.set("/apps/metacity/general/compositing_manager", "boolean", "true")
 
304
 
298
305
        if self.frontend == 'gtk_ui':
299
306
            gconf_dir = ('xml:readwrite:%s' %
300
307
                os.path.expanduser('~%s/.gconf' %
335
342
            # Set a desktop wallpaper.
336
343
            with open('/proc/cmdline', 'r') as fp:
337
344
                for background in ('/usr/share/backgrounds/edubuntu_default.png',
 
345
                    '/usr/share/xfce4/backdrops/macinnis_wallpaper.png',
 
346
                    '/usr/share/xfce4/backdrops/xubuntu-precise-right.png',
338
347
                    '/usr/share/backgrounds/warty-final-ubuntu.png'):
339
348
                    exists = os.access(background, os.R_OK)
340
349
                    if (exists and not 'access=v1' in fp.readline()):
352
361
                wm_cmd = ['matchbox-window-manager']
353
362
            elif osextras.find_on_path('openbox-lubuntu'):
354
363
                wm_cmd = ['openbox-lubuntu']
 
364
            elif osextras.find_on_path('openbox'):
 
365
                wm_cmd = ['openbox']
355
366
            else:
356
367
                raise MissingProgramError('No window manager found (tried '
357
368
                    'metacity, xfwm4, matchbox-window-manager, '
358
 
                    'openbox-lubuntu)')
 
369
                    'openbox-lubuntu, openbox)')
359
370
            wm = subprocess.Popen(wm_cmd,
360
371
                stdin=null, stdout=logfile, stderr=logfile,
361
372
                preexec_fn=self.drop_privileges)
385
396
                extras.append(proc)
386
397
 
387
398
            if os.path.exists('/usr/lib/ubiquity/panel') and "xfwm4" not in wm_cmd:
388
 
                if  "openbox-lubuntu" not in wm_cmd:
 
399
                if "openbox-lubuntu" not in wm_cmd and "openbox" not in wm_cmd:
389
400
                    extras.append(subprocess.Popen(
390
401
                        ['/usr/lib/ubiquity/panel'],
391
402
                        stdin=null, stdout=logfile, stderr=logfile,
396
407
                    ['nm-applet'],
397
408
                    stdin=null, stdout=logfile, stderr=logfile,
398
409
                    preexec_fn=self.drop_privileges))
 
410
 
 
411
            if osextras.find_on_path('ibus-daemon'):
 
412
                extras.append(subprocess.Popen(
 
413
                    ['ibus-daemon'],
 
414
                    stdin=null, stdout=logfile, stderr=logfile,
 
415
                    preexec_fn=self.drop_privileges))
 
416
 
 
417
            # Simply start bluetooth-applet, ubiquity-bluetooth-agent will
 
418
            # override it from casper to make sure it also covers the regular
 
419
            # live session
 
420
            if osextras.find_on_path('bluetooth-applet'):
 
421
                extras.append(subprocess.Popen(
 
422
                    ['bluetooth-applet'],
 
423
                    stdin=null, stdout=logfile, stderr=logfile,
 
424
                    preexec_fn=self.drop_privileges))
 
425
 
399
426
            # Accessibility tools
400
427
            if accessibility == True:
401
428
                with open('/proc/cmdline', 'r') as fp: