diff -Nuar "$1" "$2" --- ubiquity.orig/scripts/install.py 2016-05-11 14:58:57.503808383 +0200 +++ ubiquity/scripts/install.py 2016-05-11 15:22:29.231843935 +0200 @@ -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): @@ -727,6 +728,28 @@ not misc.execute('losetup', '-d', dev)): 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.