diff -Nuar ubiquity.orig/scripts/install.py ubiquity/scripts/install.py --- ubiquity.orig/scripts/install.py 2010-03-24 13:47:05.000000000 +0100 +++ ubiquity/scripts/install.py 2010-03-24 13:56:09.000000000 +0100 @@ -440,6 +440,8 @@ self.db.progress('INFO', 'ubiquity/install/log_files') self.copy_logs() + self.run_target_post_hooks() + self.db.progress('SET', end) finally: self.cleanup() @@ -976,6 +978,29 @@ 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 casper to hook into us and repeat bits of its configuration in the