diff --git a/pym/cl_fill.py b/pym/cl_fill.py index bf45cb2..455da75 100644 --- a/pym/cl_fill.py +++ b/pym/cl_fill.py @@ -24,7 +24,7 @@ from cl_vars_share import varsShare, clLocale from os.path import exists as pathexists from os import path from cl_utils import isMount, genpassword, getAvailableX11Drivers, \ - listDirectory + listDirectory,isPkgInstalled from encrypt import getHash class fillVars(varsShare): @@ -447,7 +447,8 @@ class fillVars(varsShare): videoVal = self.getValueFromCmdLine("calculate","video") videoVal = {'i915':'intel'}.get(videoVal,videoVal) - if videoVal in list_avialable_drivers: + if not isPkgInstalled('xorg-server') or \ + videoVal in list_avialable_drivers: return videoVal workedModules = map(lambda x:x[0], filter(lambda x:x[1].isdigit() and int(x[1])>0, diff --git a/pym/cl_utils.py b/pym/cl_utils.py index 92fc996..8039d9a 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -894,6 +894,20 @@ def getPkgUses(fullpkg): filter(lambda x:x, iuse))) +def isPkgInstalled(pkg,prefix='/'): + """Check is package installed""" + pkgDir = path.join(prefix,'var/db/pkg') + if "/" in pkg: + category,op,pkg = pkg.partition('/') + return bool( + filter(lambda x:x.startswith(pkg), + listDirectory(path.join(pkgDir,category)))) + else: + return bool( + filter(lambda x: filter(lambda y:y.startswith(pkg), + listDirectory(x)), + listDirectory(pkgDir,fullPath=True))) + def getPkgActiveUses(fullpkg): """Get active uses from package""" res = getPkgUses(fullpkg)