--- ubiquity.orig/scripts/install.py 2014-04-22 13:29:58.000000000 +0200 +++ ubiquity/scripts/install.py 2014-12-05 13:40:44.579816561 +0100 @@ -133,6 +133,7 @@ preexec_fn=subprocess_setup) try: self.copy_all() + self.run_target_post_hooks() except EnvironmentError as e: if e.errno in (errno.ENOENT, errno.EIO, errno.EFAULT, errno.ENOTDIR, errno.EROFS): @@ -721,6 +722,29 @@ raise install_misc.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 select_ecryptfs(self): """Is ecryptfs in use by an existing user? If so, keep it installed.