--- ubiquity.orig/scripts/install.py 2010-04-27 12:24:39.000000000 +0200 +++ ubiquity/scripts/install.py 2010-04-27 12:33:28.000000000 +0200 @@ -464,7 +464,7 @@ self.db.progress('SET', self.count) self.db.progress('INFO', 'ubiquity/install/log_files') self.copy_logs() - + self.run_target_post_hooks() self.db.progress('SET', self.end) finally: self.cleanup() @@ -1031,6 +1031,29 @@ not misc.execute('losetup', '-d', dev)): raise InstallStepError( "Failed to detach loopback device %s" % dev) + + def run_target_post_hooks(self): + """Run hook scripts from /usr/lib/ubiquity/target-postconfig. This allows + casper to hook into us and repeat bits of its configuration in the + target system.""" + + hookdir = '/usr/lib/ubiquity/target-postconfig' + + if os.path.isdir(hookdir): + # Exclude hooks containing '.', so that *.dpkg-* et al are avoided. + hooks = filter(lambda entry: '.' not in entry, os.listdir(hookdir)) + self.db.progress('START', 0, len(hooks), 'ubiquity/install/title') + self.db.progress('INFO', 'ubiquity/install/target_hooks') + for hookentry in hooks: + hook = os.path.join(hookdir, hookentry) + if not os.access(hook, os.X_OK): + self.db.progress('STEP', 1) + continue + # Errors are ignored at present, although this may change. + subprocess.call(['log-output', '-t', 'ubiquity', + '--pass-stdout', hook]) + self.db.progress('STEP', 1) + self.db.progress('STOP') def run_target_config_hooks(self): """Run hook scripts from /usr/lib/ubiquity/target-config. This allows