source: ubiquity/trunk/fuentes/debian/patches/targetposthooks.patch @ 1482

Last change on this file since 1482 was 1481, checked in by daduve, 5 years ago

Upgrading patch

File size: 1.9 KB
  • scripts/install.py

    diff -Nuar "$1" "$2" 
    old new  
    133133                    preexec_fn=subprocess_setup)
    134134            try:
    135135                self.copy_all()
     136                self.run_target_post_hooks()
    136137            except EnvironmentError as e:
    137138                if e.errno in (errno.ENOENT, errno.EIO, errno.EFAULT,
    138139                               errno.ENOTDIR, errno.EROFS):
     
    727728                    not misc.execute('losetup', '-d', dev)):
    728729                raise install_misc.InstallStepError(
    729730                    "Failed to detach loopback device %s" % dev)
     731    def run_target_post_hooks(self):
     732        """Run hook scripts from /usr/lib/ubiquity/target-postconfig. This allows
     733        casper to hook into us and repeat bits of its configuration in the
     734        target system."""
     735
     736        hookdir = '/usr/lib/ubiquity/target-postconfig'
     737
     738        if os.path.isdir(hookdir):
     739            # Exclude hooks containing '.', so that *.dpkg-* et al are avoided.
     740            hooks = filter(lambda entry: '.' not in entry, os.listdir(hookdir))
     741            self.db.progress('START', 0, len(hooks), 'ubiquity/install/title')
     742            self.db.progress('INFO', 'ubiquity/install/target_hooks')
     743            for hookentry in hooks:
     744                hook = os.path.join(hookdir, hookentry)
     745                if not os.access(hook, os.X_OK):
     746                    self.db.progress('STEP', 1)
     747                    continue
     748                # Errors are ignored at present, although this may change.
     749                subprocess.call(['log-output', '-t', 'ubiquity',
     750                                 '--pass-stdout', hook])
     751                self.db.progress('STEP', 1)
     752            self.db.progress('STOP')
    730753
    731754    def select_ecryptfs(self):
    732755        """Is ecryptfs in use by an existing user? If so, keep it installed.
Note: See TracBrowser for help on using the repository browser.