Esempio n. 1
0
 def __init__(self):
     if cmds.has_command('pkexec'):
         self._root_command_prefix_args = ['pkexec']
     elif cmds.has_command('sudo'):
         self._root_command_prefix_args = ['sudo', '-E']
     else:
         raise SystemExit(_('No suitable root privilege command found; you should install "pkexec"'))
Esempio n. 2
0
 def __init__(self):
     if cmds.has_command('pkexec'):
         self._root_command_prefix_args = ['pkexec']
     elif cmds.has_command('sudo'):
         self._root_command_prefix_args = ['sudo']
     else:
         raise SystemExit(_('No suitable root privilege command found; you should install "pkexec"'))
Esempio n. 3
0
 def __init__(self):
     if cmds.has_command('pkexec'):
         self._root_command_prefix_args = ['pkexec']
     elif cmds.has_command('sudo'):
         self._root_command_prefix_args = ['sudo']
     else:
         raise SystemExit(
             _('No suitable root privilege command found; you should install "sudo" or "pkexec" (or the system package that provides it)'
               ))
    def _maybe_update_pkgfile(self):
        if not cmds.has_command('pkgfile'):
            logging.info(_('pkgfile not found, automatically installing'))
            if subprocess.call(self._root_command_prefix_args +
                               self._pacman_install_args + [
                                   'pkgfile',
                               ]):
                logging.error(_('Failed to install pkgfile'))
                raise SystemExit

        # Update the pkgfile cache if it is older than 1 day.
        cacheexists = bool(os.listdir('/var/cache/pkgfile'))
        if not cacheexists or os.stat(
                '/var/cache/pkgfile').st_mtime < time.time() - 86400:
            logging.info(
                _('pkgfile cache is old or doesn\'t exist, automatically updating'
                  ))
            result = subprocess.call(self._root_command_prefix_args +
                                     ['pkgfile', '--update'])
            if result and not cacheexists:
                logging.error(_('Failed to create pkgfile cache'))
                raise SystemExit
            elif result:
                logging.warning(_('Failed to update pkgfile cache'))
            else:
                logging.info(_('Successfully updated pkgfile cache'))
Esempio n. 5
0
    def _maybe_update_pkgfile(self):
        if not cmds.has_command('pkgfile'):
            logging.info(_('pkgfile not found, automatically installing'))
            if subprocess.call(self._root_command_prefix_args + self._pacman_install_args + ['pkgfile',]):
                logging.error(_('Failed to install pkgfile'))
                raise SystemExit

        # Update the pkgfile cache if it is older than 1 day.
        cacheexists = bool(os.listdir('/var/cache/pkgfile'))
        if not cacheexists or os.stat('/var/cache/pkgfile').st_mtime < time.time() - 86400:
            logging.info(_('pkgfile cache is old or doesn\'t exist, automatically updating'))
            result = subprocess.call(self._root_command_prefix_args + ['pkgfile', '--update'])
            if result and not cacheexists:
                logging.error(_('Failed to create pkgfile cache'))
                raise SystemExit
            elif result:
                logging.warning(_('Failed to update pkgfile cache'))
            else:
                logging.info(_('Successfully updated pkgfile cache'))
Esempio n. 6
0
 def detect(cls):
     return cmds.has_command('apt-file')
Esempio n. 7
0
 def detect(cls):
     if cmds.has_command('pacman'):
         return True
     return False
Esempio n. 8
0
 def detect(cls):
     return cmds.has_command('pkcon')
Esempio n. 9
0
 def detect(cls):
     return cmds.has_command('apt-file')
Esempio n. 10
0
 def detect(cls):
     if cmds.has_command('pacman'):
         return True
     return False
Esempio n. 11
0
 def detect(cls):
     return cmds.has_command('pkcon')
Esempio n. 12
0
 def detect(cls):
     return cmds.has_command('yum')
Esempio n. 13
0
 def detect(cls):
     return cmds.has_command('yum')