152
152
def server_preexec(self):
153
153
signal.signal(signal.SIGUSR1, signal.SIG_IGN)
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:
162
hook, stdout=logfile, stderr=logfile,
163
preexec_fn=self.drop_privileges)
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])
157
170
null = open('/dev/null', 'w')
263
276
ck_open_session(self.uid)
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"):
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)
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"):
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)
279
288
# Session bus, apparently needed by most interfaces now
280
289
if ('DBUS_SESSION_BUS_ADDRESS' not in os.environ and