def installATIDriver(self, packageList): try: removePackages = '' installPackages = '' # Check if drivers are available in the repositories for package in packageList: # Build install packages string installPackages += ' ' + package[0] if package[1] == 1: # Check if package is installed # If it is, it's nominated for removal self.log.write('Is package installed: ' + package[0], 'ati.installATIDriver', 'debug') drvChkCmd = 'apt search ' + package[0] + ' | grep ^i | wc -l' drvChk = self.ec.run(drvChkCmd, False) if functions.strToInt(drvChk[0]) > 0: # Build remove packages string removePackages += ' ' + package[0] # Remove these packages before installation if removePackages != '': self.log.write('Remove drivers before reinstallation: ' + removePackages, 'ati.installATIDriver', 'debug') nvDrvRemCmd = 'apt-get -y --force-yes remove' + removePackages self.ec.run(nvDrvRemCmd) # Purge Nouveau (TODO: is this really necessary?) self.log.write('Purge Nouveau drivers: xserver-xorg-video-nouvea', 'ati.installATIDriver', 'debug') self.ec.run('apt-get -y --force-yes remove xserver-xorg-video-nouveau') # Install the packages self.log.write('Install drivers: ' + installPackages, 'ati.installATIDriver', 'debug') nvDrvInstCmd = 'apt-get -y --force-yes install' + installPackages self.ec.run(nvDrvInstCmd) except Exception, detail: self.log.write(detail, 'ati.installATIDriver', 'exception')
def getATI(self): # Check for ATI cards hwList = [] cmdGraph = 'lspci | grep VGA' hwGraph = self.ec.run(cmdGraph, False) #hwGraph = ['00:01.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Wrestler [Radeon HD 6310]'] for line in hwGraph: hw = line[line.find(': ') + 2:] self.log.write('ATI card found: ' + hw, 'ati.getATI', 'info') atiChk = re.search('\\b' + hwCodes[1] + '\\b', hw.lower()) if atiChk: # Get the ATI chip set serie atiSerie = re.search('\s\d{4,}', hw) if atiSerie: self.log.write('ATI chip serie found: ' + atiSerie.group(0), 'ati.getATI', 'info') intSerie = functions.strToInt(atiSerie.group(0)) # Only add series from atiStartSerie if intSerie >= atiStartSerie: drv = self.getDriver() status = functions.getPackageStatus(drv) self.log.write('ATI ' + drv + ' status: ' + status, 'ati.getATI', 'debug') hwList.append([hw, hwCodes[1], status]) else: self.log.write('ATI chip serie not supported: ' + str(intSerie), 'ati.getATI', 'warning') hwList.append([hw, hwCodes[1], packageStatus[2]]) else: self.log.write('No supported ATI chip serie found: ' + hw, 'ati.getATI', 'warning') else: self.log.write('No ATI card found', 'ati.getATI', 'warning') return hwList
def installNvidiaDriver(self, packageList): try: removePackages = '' installPackages = '' # Check if drivers are available in the repositories for package in packageList: # Build install packages string installPackages += ' ' + package[0] if package[1] == 1: # Check if package is installed # If it is, it's nominated for removal self.log.write('Is package installed: ' + package[0], 'nvidia.installNvidiaDriver', 'debug') drvChkCmd = 'apt search ' + package[0] + ' | grep ^i | wc -l' drvChk = self.ec.run(drvChkCmd, False) if functions.strToInt(drvChk[0]) > 0: # Build remove packages string removePackages += ' ' + package[0] # Remove these packages before installation if removePackages != '': self.log.write('Remove drivers before reinstallation: ' + removePackages, 'nvidia.installNvidiaDriver', 'debug') nvDrvRemCmd = 'apt-get -y --force-yes remove' + removePackages self.ec.run(nvDrvRemCmd) # Preseed answers for some packages self.preseedNvidiaPackages('install') # Install the packages self.log.write('Install drivers: ' + installPackages, 'nvidia.installNvidiaDriver', 'debug') nvDrvInstCmd = 'apt-get -y --force-yes install' + installPackages self.ec.run(nvDrvInstCmd) except Exception, detail: self.log.write(detail, 'nvidia.installNvidiaDriver', 'exception')
def getATI(self): # Check for ATI cards hwList = [] cmdGraph = "lspci | grep VGA" hwGraph = self.ec.run(cmdGraph, False) # hwGraph = ['00:01.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Wrestler [Radeon HD 6310]'] for line in hwGraph: hw = line[line.find(": ") + 2 :] self.log.write("ATI card found: " + hw, "ati.getATI", "info") atiChk = re.search("\\b" + hwCodes[1] + "\\b", hw.lower()) if atiChk: # Get the ATI chip set serie atiSerie = re.search("\s\d{4,}", hw) if atiSerie: self.log.write("ATI chip serie found: " + atiSerie.group(0), "ati.getATI", "info") intSerie = functions.strToInt(atiSerie.group(0)) # Only add series from atiStartSerie if intSerie >= atiStartSerie: drv = self.getDriver() status = functions.getPackageStatus(drv) self.log.write("ATI " + drv + " status: " + status, "ati.getATI", "debug") hwList.append([hw, hwCodes[1], status]) else: self.log.write("ATI chip serie not supported: " + str(intSerie), "ati.getATI", "warning") hwList.append([hw, hwCodes[1], packageStatus[2]]) else: self.log.write("No supported ATI chip serie found: " + hw, "ati.getATI", "warning") else: self.log.write("No ATI card found", "ati.getATI", "warning") return hwList
def installNvidiaDriver(self, packageList): try: removePackages = '' installPackages = '' # Check if drivers are available in the repositories for package in packageList: # Build install packages string installPackages += ' ' + package[0] if package[1] == 1: # Check if package is installed # If it is, it's nominated for removal self.log.write('Is package installed: ' + package[0], 'nvidia.installNvidiaDriver', 'debug') drvChkCmd = 'apt search ' + package[ 0] + ' | grep ^i | wc -l' drvChk = self.ec.run(drvChkCmd, False) if functions.strToInt(drvChk[0]) > 0: # Build remove packages string removePackages += ' ' + package[0] # Remove these packages before installation if removePackages != '': self.log.write( 'Remove drivers before reinstallation: ' + removePackages, 'nvidia.installNvidiaDriver', 'debug') nvDrvRemCmd = 'apt-get -y --force-yes remove' + removePackages self.ec.run(nvDrvRemCmd) # Preseed answers for some packages self.preseedNvidiaPackages('install') # Install the packages self.log.write('Install drivers: ' + installPackages, 'nvidia.installNvidiaDriver', 'debug') nvDrvInstCmd = 'apt-get -y --force-yes install' + installPackages self.ec.run(nvDrvInstCmd) except Exception, detail: self.log.write(detail, 'nvidia.installNvidiaDriver', 'exception')
def installATIDriver(self, packageList): try: removePackages = "" installPackages = "" # Check if drivers are available in the repositories for package in packageList: # Build install packages string installPackages += " " + package[0] if package[1] == 1: # Check if package is installed # If it is, it's nominated for removal self.log.write("Is package installed: " + package[0], "ati.installATIDriver", "debug") drvChkCmd = "apt search " + package[0] + " | grep ^i | wc -l" drvChk = self.ec.run(drvChkCmd, False) if functions.strToInt(drvChk[0]) > 0: # Build remove packages string removePackages += " " + package[0] # Remove these packages before installation if removePackages != "": self.log.write( "Remove drivers before reinstallation: " + removePackages, "ati.installATIDriver", "debug" ) nvDrvRemCmd = "apt-get -y --force-yes remove" + removePackages self.ec.run(nvDrvRemCmd) # Purge Nouveau (TODO: is this really necessary?) self.log.write("Purge Nouveau drivers: xserver-xorg-video-nouvea", "ati.installATIDriver", "debug") self.ec.run("apt-get -y --force-yes remove xserver-xorg-video-nouveau") # Install the packages self.log.write("Install drivers: " + installPackages, "ati.installATIDriver", "debug") nvDrvInstCmd = "apt-get -y --force-yes install" + installPackages self.ec.run(nvDrvInstCmd) except Exception, detail: self.log.write(detail, "ati.installATIDriver", "exception")