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"'))
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"'))
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'))
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'))
def detect(cls): return cmds.has_command('apt-file')
def detect(cls): if cmds.has_command('pacman'): return True return False
def detect(cls): return cmds.has_command('pkcon')
def detect(cls): return cmds.has_command('yum')