Fix video driver reinstall.

netsetup
Mike Hiretsky 13 years ago
parent 8596f83187
commit 103be1cbd1

Binary file not shown.

@ -23,7 +23,7 @@ from cl_datavars import glob_attr
from os import path
from os import readlink,access,R_OK
from cl_utils import isMount,typeFile,getTupleVersion,pathJoin,isFstabMount,\
listDirectory
listDirectory, getAvailableX11Drivers
from cl_distr import DistributiveRepository,PartitionDistributive
from cl_fill import clLocale
from operator import itemgetter
@ -864,11 +864,7 @@ class fillVars(object, glob_attr):
def get_os_install_x11_video_drv(self):
"""Video driver used by xorg"""
if self.Get('os_install_root_type') == 'usb-hdd':
xorg_modules_dir = '/usr/lib/xorg/modules/drivers'
avialable_drivers = \
map(lambda x: x[:-7],
filter(lambda x: x.endswith('_drv.so'),
listDirectory(xorg_modules_dir)))
avialable_drivers = getAvailableX11Drivers()
videoVal = self.getValueFromCmdLine("calculate","video")
videoVal = {'i915':'intel'}.get(videoVal,videoVal)
if videoVal in list_avialable_drivers:

@ -849,6 +849,8 @@ class cl_install(color_print, SignalInterrupt):
self.clVars.Get('hr_cpu_num'))
self.printSUCCESS(_("Videocard vendor")+": %s"%
self.clVars.Get('hr_video'))
self.printSUCCESS(_("{0} video driver").format("Xorg")+": %s"%
self.clVars.Get('os_install_x11_video_drv'))
self.printSUCCESS(_("Screen resolution")+": %s"%
self.clVars.Get('os_install_x11_resolution'))
self.defaultPrint("%s\n"%_("Localization"))
@ -1767,7 +1769,20 @@ class cl_install(color_print, SignalInterrupt):
if path.exists(pathGlModules):
self.printMessageForTest(_("Configure OpenGL"))
self.printByResult(self.setupOpenGL())
# if change video driver, then restore initramfs
installDrv = self.clVars.Get('os_install_x11_video_drv')
if self.clVars.Get('os_x11_video_drv') != installDrv:
initrdPath = path.join('/boot',
self.clVars.Get('os_install_initrd'))
initrdInstallPath = path.join('/boot',
self.clVars.Get('os_install_initrd_install'))
needMod = {'radeon':'radeon',
'intel':'i915',
'nouveau':'nouveau'}.get(installDrv,'uvesafb')
if not InitRamFs(initrdPath).isModuleInside(needMod):
self.printMessageForTest(_("Restore initramfs"))
self.printByResult(InitRamFs(initrdInstallPath)\
.cleanInitRamFs(initrdPath, x11_video_drv))
except (InstallError,DistributiveError),e:
error = e
except Exception,e:

@ -133,6 +133,16 @@ class InitRamFs:
os.chdir(self.prevDir)
return res
def searchInside(self,searchFunc):
"""Search data in file list of initramfs"""
cpioProcess = process("cpio", "-tf",
stdin=process("gzip", "-dc", self.initrdFile))
return filter(searchFunc,cpioProcess)
def isModuleInside(self,moduleName):
"""Search module in initramfs"""
return bool(self.searchInside(lambda x: "%s.ko"%moduleName in x))
def _packInitRamfs(self,newInitramfsFile=None):
"""Pack initramfs"""
self.prevDir = os.getcwd()

Loading…
Cancel
Save