Optimize get information from image (available vidoe and netconf)

master3.3
Mike Hiretsky 12 years ago
parent 8406ccb331
commit 9a944e3749

@ -98,6 +98,21 @@ class VariableOsInstallX11Resolution(ResolutionVariable):
else:
return self.choice()[-1]
class VariableOsInstallX11VideoAvailable(VideoVariable):
"""
Get available (already installed or installable drivers
"""
type = "list"
def get(self):
image = self.Get('cl_image')
if image:
with image as distr:
distrPath = image.getDirectory()
if isPkgInstalled('xorg-server',prefix=distrPath):
return getAvailableVideo(prefix=distrPath)+['other']
return []
class VariableOsInstallX11VideoDrv(VideoVariable):
"""
Video driver used by xorg
@ -112,13 +127,7 @@ class VariableOsInstallX11VideoDrv(VideoVariable):
def choice(self):
"""Get available (already installed or installable drivers"""
image = self.Get('cl_image')
if image:
with image as distr:
distrPath = image.getDirectory()
if isPkgInstalled('xorg-server',prefix=distrPath):
return getAvailableVideo(prefix=distrPath)+['other']
return []
return self.Get('os_install_x11_video_available')
def get(self):
# get available videodriver list from install or configure distributive

@ -520,6 +520,26 @@ class VariableOsInstallNetNmroute(VariableOsInstallNetRoute):
x[NET]!="default",routeMatrix))))
return self.performRouteData(getRouteForInterfaceNM)
class VariableOsInstallNetConfAvailable(NetVariable):
"""
Available net configuration
"""
type = "list"
def get(self):
mapNetConf = (('networkmanager','net-misc/networkmanager',
_("NetworkManager")),
('openrc','',_('OpenRC')))
image = self.Get('cl_image')
if image:
with image as distr:
distrPath = image.getDirectory()
return map(itemgetter(0,2),
filter(lambda x:not x[1] or isPkgInstalled(x[1],
prefix=distrPath),
mapNetConf))
return map(itemgetter(0,2),mapNetConf[-1:])
class VariableOsInstallNetConf(NetVariable):
"""
Net setup (networkmanager or openrc)
@ -541,24 +561,14 @@ class VariableOsInstallNetConf(NetVariable):
nm = "networkmanager"
else:
nm = ""
for val,comment in self.choice():
for val,comment in self.Get('os_install_net_conf_available'):
if nm == val:
return nm
else:
return "openrc"
def choice(self):
mapNetConf = (('networkmanager','net-misc/networkmanager',_("NetworkManager")),
('openrc','',_('OpenRC')))
image = self.Get('cl_image')
if image:
with image as distr:
distrPath = image.getDirectory()
return map(itemgetter(0,2),
filter(lambda x:not x[1] or isPkgInstalled(x[1],
prefix=distrPath),
mapNetConf))
return map(itemgetter(0,2),mapNetConf[-1:])
return self.Get('os_install_net_conf_available')
class VariableOsInstallNetDnsSearch(NetVariable):
"""

Loading…
Cancel
Save