~xubuntu-dev/ubiquity/lp1437180_feh

« back to all changes in this revision

Viewing changes to bin/ubiquity-dm

  • Committer: Kent Baxley
  • Date: 2012-06-29 14:52:53 UTC
  • mto: This revision was merged to the branch mainline in revision 5541.
  • Revision ID: kent.baxley@canonical.com-20120629145253-6v80559p9jx2csnf
put the actual fixed-up file in place :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
    def server_preexec(self):
153
153
        signal.signal(signal.SIGUSR1, signal.SIG_IGN)
154
154
 
 
155
    def run_hooks(self, hookdir):
 
156
        if os.path.isdir(hookdir):
 
157
            hooks = [entry for entry in os.listdir(hookdir)]
 
158
            for hookentry in hooks:
 
159
                hook = os.path.join(hookdir, hookentry)
 
160
                with open('/var/log/installer/dm', 'a') as logfile:
 
161
                    subprocess.call(
 
162
                        hook, stdout=logfile, stderr=logfile,
 
163
                        preexec_fn=self.drop_privileges)
 
164
                       
155
165
    def run(self, *program):
 
166
        # extract the program basename to see if we are in oem-config or ubiquity
 
167
        program_basename = os.path.basename(program[0])
 
168
        
156
169
        extras = []
157
170
        null = open('/dev/null', 'w')
158
171
        try:
263
276
        ck_open_session(self.uid)
264
277
        
265
278
        # run simple, custom scripts during install time
266
 
        if sys.argv[4] == '/usr/bin/ubiquity':
267
 
            for root, dirs, files in os.walk("/usr/lib/ubiquity/dm-scripts/install"):
268
 
                for file in files:
269
 
                    install_script = os.path.join(root, file)
270
 
                    subprocess.Popen(install_script, stdin=null, stdout=logfile, stderr=logfile, preexec_fn=self.drop_privileges)
 
279
        if program_basename == 'ubiquity':
 
280
            hookdir = '/usr/lib/ubiquity/dm-scripts/install'
 
281
            self.run_hooks(hookdir)
271
282
 
272
283
        # run simple, custom scripts during  oem-config
273
 
        if sys.argv[4] == '/usr/sbin/oem-config-wrapper':
274
 
            for root, dirs, files in os.walk("/usr/lib/ubiquity/dm-scripts/oem"):
275
 
                for file in files:
276
 
                   oem_script = os.path.join(root, file)
277
 
                   subprocess.Popen(oem_script, stdin=null, stdout=logfile, stderr=logfile, preexec_fn=self.drop_privileges)
 
284
        if program_basename == 'oem-config-wrapper':
 
285
            hookdir = '/usr/lib/ubiquity/dm-scripts/install'
 
286
            self.run_hooks(hookdir)
278
287
 
279
288
        # Session bus, apparently needed by most interfaces now
280
289
        if ('DBUS_SESSION_BUS_ADDRESS' not in os.environ and