home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/env python
- #Developed by Alberto Milone (aka tseliot)
-
- import sys
- import commands
- import string
- import os, popen2, fcntl, fcntl, select
- from os.path import isfile
- import shutil
- import fileinput, re
- import main
- import objects
-
- atimanlatest = '8.36.5'
- atimanlegacy = '8.28.8'
- nvmanlatest = '9755'
- nvmannewlegacy = '9631'
- nvmanlegacy = '7185'
-
- class Compatibcheck:
- #def init(self):
- # self.brandname = 'none'# either "Nvidia" or "ATI"
-
- def check(self):#oldname "checkcompatib()"
- a = main.getCommandOutput('lspci | grep "VGA"')
- b = a.lower().split(' ')
- c = self.brandname.lower()
- if c not in b:#if there's no trace of either ati or nvidia in the output
- print 'ENVY ERROR: ' + self.brandname + ' card not found'
- event = 'error'
- else:
- event = 'passed'
- return event
-
- class Specsdetect:
-
- def init(self):
- # self.cards = {}
- # self.middlecards = {}
- # self.legacycards = {}
- self.details = {}#all the details about the card, driver, arch are stored here
-
- def codename(self):
- """
- Get system codename, can be warty/hoary/breezy/dapper/edgy/etch
- """
- p = os.popen("lsb_release -c")
- try:
- codename = p.readline().strip()
- tokens = codename.split("\t")
- finally:
- p.close()
- self.details['osname'] = tokens[-1].lower()
- self.legacyos = ['dapper', 'etch']
- #return osname
- #self.details['osname'] = osname#formerly known as "systemname"
-
- def architecture(self):
- """
- Detect whether the architecture is x86/ppc/amd64
- """
- arch = os.uname()[-1]
- if arch in ('ppc', 'ppc64'):
- arch = 'powerpc'
- elif arch =='x86_64':
- arch = 'x86_64'
- elif arch in ('i386','i686','i586','k7'):
- arch = 'x86'
- #return arch
- self.details['arch'] = arch#formerly known as "arca"
-
- def systemcheck(self):#It is based upon details[0] and details[1]
- if self.details['osname'] == 'dapper':
- if self.details['arch'] == 'x86':
- print 'Ubuntu Dapper 32bit'
- elif self.details['arch'] == 'x86_64':
- print 'Ubuntu Dapper 64bit'
- else:
- print 'ENVY ERROR: Your architecture is not supported by Envy'
- sys.exit()
- elif self.details['osname'] == 'edgy':#SUPPORT FOR EDGY
- if self.details['arch'] == 'x86':
- print 'Ubuntu Edgy 32bit'
- elif self.details['arch'] == 'x86_64':
- print 'Ubuntu Edgy 64bit'
- else:
- print 'ENVY ERROR: Your architecture is not supported by Envy'
- sys.exit()
- elif self.details['osname'] == 'feisty':#SUPPORT FOR FEISTY
- if self.details['arch'] == 'x86':
- print 'Ubuntu Feisty 32bit'
- elif self.details['arch'] == 'x86_64':
- print 'Ubuntu Feisty 64bit'
- else:
- print 'ENVY ERROR: Your architecture is not supported by Envy'
- sys.exit()
- elif self.details['osname'] == 'cassandra':#SUPPORT FOR LINUX MINT CASSANDRA
- self.details['osname'] = 'feisty'#this will make it act like feisty
- if self.details['arch'] == 'x86':
- print 'Linux Mint Cassandra 32bit'
- elif self.details['arch'] == 'x86_64':
- print 'Linux Mint Cassandra 64bit'
- else:
- print 'ENVY ERROR: Your architecture is not supported by Envy'
- sys.exit()
- elif self.details['osname'] == 'etch':#SUPPORT FOR ETCH
- if self.details['arch'] == 'x86':
- print 'Debian Etch 32bit'
- elif self.details['arch'] == 'x86_64':
- print 'Debian Etch 64bit'
- else:
- print 'ENVY ERROR: Your architecture is not supported by Envy'
- sys.exit()
-
- else:
- print "ENVY ERROR: Your Operative System does not seem to be supported by Envy"
- sys.exit()
-
- def drivertype(self):
- geforcego = ['0112', '0172', '0174', '0175', '0176', '0177', '0179', '0286', '017d' ]#need to use dfp
- availabledrv = []#the list of drivers which your system supports
- syscards = main.getCommandOutput('lspci -n | grep "0300" | cut -d " " -f3 | sed s/.*://').strip().lower()
- systemcards = syscards.split('\n')
- for element in systemcards:
- try:
- systemcards.remove('\n')
- except ValueError:
- pass
- for card in systemcards:
- if card in geforcego:
- self.details['geforcego'] = 'true'#will be used by nvxorgset
- #detect the card and choose the driver accordingly
- if self.cards.setdefault(card, 'N/A') != 'N/A':
- print 'Your graphic card has been detected as a ' + self.cards[card]
- print 'Your graphic card is supported by the latest driver'
- drvtype = 'latest'
- elif self.middlecards.setdefault(card, 'N/A') != 'N/A':
- print 'Your graphic card has been detected as a ' + self.middlecards[card]
- print 'Your graphic card is supported by the new legacy driver'
- drvtype = 'middle'
- elif self.legacycards.setdefault(card, 'N/A') != 'N/A':
- print 'Your graphic card has been detected as a ' + self.legacycards[card]
- print 'Your graphic card is supported by the legacy Driver'
- drvtype = 'oldest'
- else:
- drvtype = 'unsupported'
- availabledrv.append(drvtype)
- if 'latest' in availabledrv:#select the driver following this priority: latest, middle, oldest
- self.details['drvtype'] = 'latest'
- else:
- if 'middle' in availabledrv:
- self.details['drvtype'] = 'middle'
- else:
- if 'oldest' in availabledrv:
- self.details['drvtype'] = 'oldest'
- else:#if the CARD is NOT SUPPORTED
- print 'ENVY ERROR: Envy does not recognise your card as compatible with any version of the driver.\
- this might happen because either your card is not supported by the driver or Envy\'s hardware\
- detection failed. You can try the manual installation at your risk.'
- sys.exit()
- #while 1:#If the id of the card is not in the list
- # unsupported = raw_input('\nYour graphic card does not seem to be supported by the driver.\n\n\
- # Would you like to go ahead with the installation even if, according to Envy, your card is not supported?\n\
- # (Type either "yes" or "no")\n').strip()
- # if unsupported == 'yes':
- # break
- # elif unsupported == 'no':
- # sys.exit()
- # break
- #self.details['drvtype'] = 'latest'
-
-
- def geforcegocheck(self):
- geforcego = ['0112', '0172', '0174', '0175', '0176', '0177', '0179', '0286', '017d' ]#need to use dfp
- availabledrv = []#the list of drivers which your system supports
- systemcards = []
- p = os.popen('lspci -n')
- indentifier1 = re.compile('.*0300:.*:(.+) \(.+\)\n')
- indentifier2 = re.compile('.*0300:.*:(.+)\n')
- for line in p:#self.completetxt:#self.logged:
- m1 = indentifier1.match(line)
- m2 = indentifier2.match(line)
- if m1:
- id = m1.group(1).strip().lower()
- systemcards.append(id)
- elif m2:
- id = m2.group(1).strip().lower()
- systemcards.append(id)
- for card in systemcards:
- if card in geforcego:
- self.details['geforcego'] = 'true'#will be used by nvxorgset
-
-
-
-
- def driverpushback(self):
- availabledrv = []#the list of drivers which your system supports
- #syscards = main.getCommandOutput('lspci -n | grep "0300" | cut -d " " -f3 | sed s/.*://').strip().lower()
- #systemcards = syscards.split('\n')
- #for element in systemcards:
- # try:
- # systemcards.remove('\n')
- # except ValueError:
- # pass
- systemcards = []
- p = os.popen('lspci -n')
- indentifier1 = re.compile('.*0300:.*:(.+) \(.+\)\n')
- indentifier2 = re.compile('.*0300:.*:(.+)\n')
- for line in p:#self.completetxt:#self.logged:
- m1 = indentifier1.match(line)
- m2 = indentifier2.match(line)
- if m1:
- id = m1.group(1).strip().lower()
- systemcards.append(id)
- elif m2:
- id = m2.group(1).strip().lower()
- systemcards.append(id)
-
-
- for card in systemcards:
- #detect the card and choose the driver accordingly
- if self.cards.setdefault(card, 'N/A') != 'N/A':
- #print 'Your graphic card has been detected as a ' + self.cards[card]
- #print 'Your graphic card is supported by the latest driver'
- drvtype = 'latest'
- elif self.middlecards.setdefault(card, 'N/A') != 'N/A':
- #print 'Your graphic card has been detected as a ' + self.middlecards[card]
- #print 'Your graphic card is supported by the new legacy driver'
- drvtype = 'middle'
- elif self.legacycards.setdefault(card, 'N/A') != 'N/A':
- #print 'Your graphic card has been detected as a ' + self.legacycards[card]
- #print 'Your graphic card is supported by the legacy Driver'
- drvtype = 'oldest'
- else:
- drvtype = 'unsupported'
- availabledrv.append(drvtype)
- if 'latest' in availabledrv:#select the driver following this priority: latest, middle, oldest
- self.details['drvtype'] = 'latest'
- else:
- if 'middle' in availabledrv:
- self.details['drvtype'] = 'middle'
- else:
- if 'oldest' in availabledrv:
- self.details['drvtype'] = 'oldest'
-
- def atimanver(self):
- while 1:
- drvchoice = raw_input('\n\
- Select the version of the driver which would you like to install:\n\
- 1 - ' + atimanlatest + ' (latest)\n\
- 2 - ' + atimanlegacy + ' (legacy)\n\
- 3 - Back to main menu\n\
- (Type 1, 2 or 3)\n').strip()
- if drvchoice == '1':
- self.details['drvtype'] = 'latest'
- self.details['manualchoice2'] = 'notmenu'
- break
- elif drvchoice == '2':
- self.details['drvtype'] = 'oldest'
- self.details['manualchoice2'] = 'notmenu'
- break
- elif drvchoice == '3':
- self.details['drvtype'] = 'oldest'
- self.details['manualchoice2'] = 'menu'
- break
- if self.details['manualchoice2'] == 'menu':
- objects.mainmenu()
- else:
- self.atireleasenum()
-
- def nvidiamanver(self):
- while 1:
- drvchoice = raw_input('\n\
- Select the version of the driver which would you like to install:\n\
- 1 - ' + nvmanlatest + ' (latest)\n\
- 2 - ' + nvmannewlegacy + ' (new legacy)\n\
- 3 - ' + nvmanlegacy + ' (legacy)\n\
- 4 - Back to main menu\n\
- (Type 1, 2, 3 or 4)\n').strip()
- if drvchoice == '1':
- self.details['drvtype'] = 'latest'
- self.details['manualchoice1'] = 'notmenu'
- break
- elif drvchoice == '2':
- self.details['drvtype'] = 'middle'
- self.details['manualchoice1'] = 'notmenu'
- break
- elif drvchoice == '3':
- self.details['drvtype'] = 'oldest'
- self.details['manualchoice1'] = 'notmenu'
- break
- elif drvchoice == '4':
- #self.details['drvtype'] = 'oldest'
- self.details['manualchoice1'] = 'menu'
- break
- if self.details['manualchoice1'] == 'menu':
- objects.mainmenu()
- else:
- self.nvreleasenum()
-
- def manualdetails(self):
- while 1:
- drvchoice = raw_input('\n\
- Select the kind of driver which would you like to install:\n\
- 1 - ATI\n\
- 2 - NVIDIA\n\
- 3 - Back to main menu\n\
- (Type either 1 or 2)\n').strip()
- if drvchoice == '1':
- self.details['cardbrand'] = 'ati'
- self.details['manualchoice'] = 'notmenu'
- break
- elif drvchoice == '2':
- self.details['cardbrand'] = 'nvidia'
- self.details['manualchoice'] = 'notmenu'
- break
- elif drvchoice == '3':
- self.details['manualchoice'] = 'menu'
- break
- if self.details['manualchoice'] == 'menu':
- objects.mainmenu()
- else:
- if self.details['cardbrand'] == 'ati':
- self.atimanver()
- elif self.details['cardbrand'] == 'nvidia':
- self.nvidiamanver()
-
-
-
- def nvreleasenum(self):
- if self.details['drvtype'] == 'latest':
- version = '1.0-' + nvmanlatest#9746
- elif self.details['drvtype'] == 'middle':
- version = '1.0-' + nvmannewlegacy#9631
- elif self.details['drvtype'] == 'oldest':
- version = '1.0-' + nvmanlegacy#7184
- self.details['ver'] = version#add the version of the driver (e.g. '1.0-9746') to the "details" list
-
- def atireleasenum(self):
- if self.details['drvtype'] == 'latest':
- version = atimanlatest#'8.33.6'
- elif self.details['drvtype'] == 'middle':#doesn't exist
- version = 'none'
- elif self.details['drvtype'] == 'oldest':
- version = atimanlegacy#'8.28.8'
- self.details['ver'] = version#add the version of the driver (e.g. '1.0-9746') to the "details" list
-
- #FUNCTIONS TO EDIT THE NVIDIA BUILD SCRIPTS
-
- def strippedver(self):
- complete = self.details['ver']
- stripped = complete.split('1.0-')
- stripped.remove('')
- self.details['strippedver'] = stripped[0]#the stripped version of the driver (e.g. 9746)
- next = int(stripped[0]) + 2#the next version of the driver (needed by the Debian scripts)
- self.details['nextver'] = '1.0.' + str(next)#(e.g. '1.0.9746')
-
- def changelog(self):
- lines = []
- if self.details['drvtype'] == 'oldest':
- file1 = '/usr/share/envy/nvidia-graphics-drivers-legacy/debian/changelog'
- else:
- file1 = '/usr/share/envy/nvidia-graphics-drivers/debian/changelog'
- #nvidia-graphics-drivers (1.0.9746-2) unstable; urgency=low
- #release = '1.0.' + self.details['strippedver'] + '-100'
- versiontrick = str(int(self.details['strippedver']) +1)#trick
- release = '1:1.0.' + versiontrick#use the version trick
- opsystem = self.details['osname']
- if self.details['drvtype'] == 'oldest':
- pat1 = re.compile('nvidia-graphics-drivers-legacy (\(.+\)) (.+); urgency=low')
- else:
- pat1 = re.compile('nvidia-graphics-drivers (\(.+\)) (.+); urgency=low')
- text = open(file1, 'r')
- optext = text.readlines()
- for line in optext:
- m1 = pat1.match(line)
- if m1:
- if self.details['drvtype'] == 'oldest':
- line = 'nvidia-graphics-drivers-legacy (' + release + ') ' + opsystem + '; urgency=low\n'
- else:
- line = 'nvidia-graphics-drivers (' + release + ') ' + opsystem + '; urgency=low\n'
- lines.append(line)
- else:
- lines.append(line)
- text.close()
- sep = ''
- modtext = open(file1, 'w')
- a = sep.join(lines)
- modtext.write(a)
- modtext.close()
-
- def rules(self):
- if self.details['drvtype'] != 'oldest':
- lines = []
- #if self.details['drvtype'] == 'oldest':
- # file1 = '/usr/share/envy/nvidia-graphics-drivers-legacy/debian/rules'
- #else:
- file1 = '/usr/share/envy/nvidia-graphics-drivers/debian/rules'
- #nvidia-graphics-drivers (1.0.9746-2) unstable; urgency=low
- release = '1.0.' + self.details['strippedver']
- #opsystem = self.details['osname']
- pat1 = re.compile('latest:=(.+)\n')
- text = open(file1, 'r')
- optext = text.readlines()
- for line in optext:
- m1 = pat1.match(line)
- if m1:
- ##line = 'latest:=' + release + '\n'
- line = 'latest:=' + '1.0.' + nvmanlatest + '\n'
- #else: line = 'nvidia-graphics-drivers (' + release + ') ' + opsystem + '; urgency=low\n'
- lines.append(line)
- else:
- lines.append(line)
- text.close()
- sep = ''
- modtext = open(file1, 'w')
- a = sep.join(lines)
- modtext.write(a)
- modtext.close()
-
- def upstream(self):
- lines = []
- if self.details['drvtype'] == 'oldest':
- file1 = '/usr/share/envy/nvidia-graphics-drivers-legacy/debian/upstream_info'
- else:
- file1 = '/usr/share/envy/nvidia-graphics-drivers/debian/upstream_info'
- #nvidia-graphics-drivers (1.0.9746-2) unstable; urgency=low
- release = self.details['strippedver']
- next = self.details['nextver']
- pat1 = re.compile('RELEASE=.+(.*)')
- pat2 = re.compile('NEXTVER=.+(.*)')
- text = open(file1, 'r')
- optext = text.readlines()
- for line in optext:
- m1 = pat1.match(line)
- m2 = pat2.match(line)
- if m1:
- line = 'RELEASE=' + release + '\n'
- lines.append(line)
- elif m2:
- line = 'NEXTVER='+ next + '\n'
- lines.append(line)
- else:
- lines.append(line)
- text.close()
- sep = ''
- modtext = open(file1, 'w')
- a = sep.join(lines)
- modtext.write(a)
- modtext.close()
-
- def control(self):
- if self.details['drvtype'] != 'oldest':
- osdepend = ['dapper']
- lines = []
- #if self.details['drvtype'] == 'oldest':
- # file1 = '/usr/share/envy/nvidia-graphics-drivers-legacy/debian/rules'
- #else:
- file1 = '/usr/share/envy/nvidia-graphics-drivers/debian/control.in'
- #nvidia-graphics-drivers (1.0.9746-2) unstable; urgency=low
- xreleasenew = '>= 1:7.0.0'
- xreleaseold = '>= 7.0.0'#only for Dapper
- #opsystem = self.details['osname']
- pat1 = re.compile('Depends\: nvidia\-kernel\-\#VERSION\#\, x11\-common \((.*)\)\, \$\{shlibs\:Depends\}\n')
- text = open(file1, 'r')
- optext = text.readlines()
- for line in optext:
- m1 = pat1.match(line)
- if m1:
- ##line = 'latest:=' + release + '\n'
- if self.details['osname'] in self.legacyos:
- release = xreleaseold
- else:
- release = xreleasenew
- line = 'Depends: nvidia-kernel-#VERSION#, x11-common (' + release + '), ${shlibs:Depends}\n'
- #else: line = 'nvidia-graphics-drivers (' + release + ') ' + opsystem + '; urgency=low\n'
- lines.append(line)
- else:
- lines.append(line)
- text.close()
- sep = ''
- modtext = open(file1, 'w')
- a = sep.join(lines)
- modtext.write(a)
- modtext.close()
-
-
-
- def nvidiapkgmake(self):
- #if self.details['drvtype'] == 'oldest':
- # nvdistinction = 'nvidia-graphics-drivers-legacy'
- #else:
- if self.details['drvtype'] == 'oldest':
- nvdistinction = 'nvidia-graphics-drivers-legacy'
- else:
- nvdistinction = 'nvidia-graphics-drivers'
- os.system('sudo chmod +x /usr/share/envy/' + nvdistinction + '/*.run')
- os.system('cd /usr/share/envy/' + nvdistinction + '/ && sudo dpkg-buildpackage -b -uc')
-
- def nvidiakcommon(self):#Make sure this file is installed on Etch
- nvkcommon = []
- p = os.popen('sudo aptitude show nvidia-kernel-common')
- indentifier = re.compile('.*State\:(.*)\n')
- for line in p:#self.completetxt:#self.logged:
- m1 = indentifier.match(line)
- if m1:
- id = m1.group(1).strip().lower()
- if id == 'installed':
- nvkcommon.append('yes')
- #print nvkcommon
- if 'yes' not in nvkcommon:
- print 'ENVY ERROR: nvidia-kernel-common is not installed and cannot be installed!'
- else:
- print 'OK: nvidia-kernel-common is installed'
-
-
- def nvpkginstall1(self):
- drvname = self.details['drvname']
- #print 'Using version: ' + drvname#Rimuovere
- os.system('sudo apt-get install -f -y')
- os.system('sudo apt-get install -y nvidia-kernel-common')#needed by Etch
- if self.details['osname'] == 'etch':
- self.nvidiakcommon()#this should throw an error and make Envy abort on Etch if needed
- if self.details['drvtype'] == 'oldest':#TEMPORARY FIX
- os.system('sudo apt-get install -y nvidia-settings nvidia-xconfig')
- # os.system('sudo apt-get install -y nvidia-legacy-kernel-source')
- #os.system('sudo apt-get install -y nvidia-glx-legacy')
- #os.system('sudo apt-get install -y nvidia-glx-legacy-dev')
-
- if self.details['drvtype'] == 'oldest':
- os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-legacy-kernel-source*.deb')
- else:
- os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-kernel-source_*.deb')#what if nvidia-new-kernel-source
-
- #os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-glx_*.deb')
- #os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-glx-dev_*.deb')
- #elif self.details['drvtype'] == 'latest':
- # os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-new-kernel-source_*.deb')
- ##os.system('sudo dpkg -i nvidia-glx_' + drvname + '*.deb')
- ##os.system('sudo dpkg -i nvidia-glx-dev_' + drvname + '*.deb')
- ##os.system('sudo dpkg -i nvidia-kernel-source_' + drvname + '*.deb')
-
- def nvpkginstall2(self):
- drvname = self.details['drvname']
- #print 'Using version: ' + drvname#Rimuovere
- os.system('sudo rm /usr/lib/nvidia/libGL.so.1*')
- os.system('sudo apt-get -y remove --purge nvidia-glx-new')
- os.system('sudo apt-get install -f -y')
- if self.details['drvtype'] == 'oldest':#TEMPORARY FIX
- os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-glx-legacy_*.deb')
- #os.system('sudo apt-get install -y nvidia-glx-legacy-dev')#NOT NEEDED
- else:
- #os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-kernel-source_*.deb')
- os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-glx_*.deb')
- #os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-glx-dev_*.deb')#NOT NEEDED
- #elif self.details['drvtype'] == 'latest':
- # os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-glx-new_*.deb')
- # os.system('cd /usr/share/envy/ && sudo dpkg -i nvidia-glx-new-dev_*.deb')
-
-
-
- def nvrmdeb(self):
- #Remove any old fglrx debs from /usr/src/:
- os.system('sudo rm /usr/src/nvidia-kernel*.deb')
- os.system('sudo rm /usr/src/nvidia-legacy-kernel*.deb')#useful?
- os.system('sudo rm /usr/src/nvidia-new-kernel*.deb')
-
- def nvkmod(self):#compile ATI kernel module
- os.system('sudo module-assistant prepare')
- os.system('sudo module-assistant update')
- if self.details['osname'] != 'etch':
- glx = 'nvidia'
- glxlegacy = 'nvidia-legacy-kernel-source'
- else:
- glx = 'nvidia'
- glxlegacy = 'nvidia-legacy-kernel-source'
- if self.details['drvtype'] != 'oldest':#TEMPORARY FIX
- os.system('sudo module-assistant build ' + glx)#CHECK IF ITS NAME HAS CHANGED
- os.system('sudo module-assistant install ' + glx)
- else:
- os.system('sudo module-assistant build ' + glxlegacy)
- os.system('sudo module-assistant install ' + glxlegacy)
- os.system('sudo depmod -a')
-
-
- def buildclean(self):
- if self.details['drvtype'] == 'oldest':
- nvdistinction = 'nvidia-graphics-drivers-legacy'
- glx = 'nvidia-glx-legacy'
- src = 'nvidia-legacy-kernel'
- else:
- nvdistinction = 'nvidia-graphics-drivers'
- glx = 'nvidia-glx'
- src = 'nvidia-kernel'
- os.system('sudo rm /usr/share/envy/*.deb')
- os.system('sudo rm /usr/share/envy/*.asc')
- os.system('sudo rm /usr/share/envy/*.changes')
- os.system('sudo rm /usr/share/envy/' + nvdistinction + '/*stamp')
- os.system('sudo rm -R /usr/share/envy/' + nvdistinction + '/NVIDIA-Linux-' + self.details['arch'] + '-' + self.details['ver'] + '-' + self.details['pkg'] )
- os.system('sudo rm /usr/share/envy/' + nvdistinction + '/*.tar.gz')
- os.system('sudo rm /usr/share/envy/' + nvdistinction + '/debian/files')
- os.system('sudo rm /usr/share/envy/' + nvdistinction + '/debian/' + glx + '.postinst.debhelper')
- os.system('sudo rm /usr/share/envy/' + nvdistinction + '/debian/' + glx + '.postrm.debhelper')
- os.system('sudo rm /usr/share/envy/' + nvdistinction + '/debian/' + glx + '.prerm.debhelper')
- os.system('sudo rm /usr/share/envy/' + nvdistinction + '/debian/' + glx + '.substvars')
- os.system('sudo rm /usr/share/envy/' + nvdistinction + '/debian/' + glx + '.substvars.bak')
- os.system('sudo rm -R /usr/share/envy/' + nvdistinction + '/debian/' + glx)
- os.system('sudo rm -R /usr/share/envy/' + nvdistinction + '/debian/' + glx + '-dev')
- os.system('sudo rm -R /usr/share/envy/' + nvdistinction + '/debian/' + src + '-source')
- os.system('sudo rm -R /usr/share/envy/' + nvdistinction + '/debian/' + glx + '-ia32')
-
-
-
- #pkgver = drivertype()
- def nvpkg(self):#There's no such thing for ATI cards
- if self.details['arch'] == 'x86':#arca
- pkg = 'pkg0' #pkg1
- elif self.details['arch'] == 'x86_64':
- pkg = 'pkg2'#paca
- self.details['pkg'] = pkg
- #return paca
-
- def nvvarsum(self):#md5
- #arca = architecture()
- if self.details['arch'] == 'x86':
- if self.details['drvtype'] == 'latest':
- md5old = '991e03ceaff94fa8113ac04a541ec576'#575f988468f2c34a302da3d21e282689#cf0cdbd9099a6df028de429044e7f4da
- elif self.details['drvtype'] == 'middle':#up to 96xx
- md5old = 'b0d721c962c4df1a028ae18416d7e862'#3676f622897d22f1815365b44139899e
- else: md5old = '5bba3ec9075a42b33bf51b431123cc15'#149e5e9934387da5da6ebe21d694e82a#68cf7f155786daf6946b9daeb64c7a35#Legacy
- elif self.details['arch'] == 'x86_64':
- if self.details['drvtype'] == 'latest':
- md5old = '88eb6b856ab201dc00663165e10109f9'#c0afc66e1c21a9a54ba6719b8edd3166
- elif self.details['drvtype'] == 'middle':#up to 96xx
- md5old = '64b88c6f405e7f2dd1607c0062c0c1f3'
- else: md5old = 'cdca6c2eb474717935b76dd50c22323f'#332850387c4e7a4619753b856e3199e5#Legacy
- #return md5old
- self.details['md5old'] = md5old
-
- def ativarsum(self):#md5
- #arca = architecture()
- if self.details['arch'] == 'x86':
- if self.details['drvtype'] == 'latest':
- md5old = 'bf056417ac6c57acdf5e5a6bb99a7dae'#c580c83cbf99007a4256fd40368cb2d9
- elif self.details['drvtype'] == 'middle':#there's no middle driver for ATI
- md5old = 'none'
- else: md5old = '58189d7cc3625e399b1a434df893100f'#32 bit Legacy
- elif self.details['arch'] == 'x86_64':
- if self.details['drvtype'] == 'latest':
- md5old = 'bf056417ac6c57acdf5e5a6bb99a7dae'#the same as 32bit
- elif self.details['drvtype'] == 'middle':#there's no middle driver for ATI
- md5old = 'none'
- else: md5old = '58189d7cc3625e399b1a434df893100f'#64bit Legacy
- #return md5old
- self.details['md5old'] = md5old
-
-
- '''THE OBJECT WILL CHOOSE THE FUNCTION TO CALL ACCORDING TO THE DRIVER'''
- def nvpkgname(self):#the name of the Nvidia installer
- #driver = 'NVIDIA-Linux-' + arca + '-' + vera + '-' + paca + '.run'
- driver = 'NVIDIA-Linux-' + self.details['arch'] + '-' + self.details['ver'] + '-' + self.details['pkg'] + '.run'#architecture,version,pkg
- #return driver#pkgname
- self.details['drvname'] = driver
- def atipkgname(self):
- if self.details['drvtype'] == 'oldest':#the name of the OLD ATI installer
- driver = 'ati-driver-installer-' + self.details['ver'] + '.run'#version
- else:#the name of the NEW ATI installer
- driver = 'ati-driver-installer-' + self.details['ver'] + '-x86.x86_64.run'#version
- self.details['drvname'] = driver
-
- def nvftpfolder(self):
- nvidiaftp = 'Linux-' + self.details['arch'] + '/' + self.details['ver']
- self.details['nvftpdir'] = nvidiaftp
- #return nvidiaftp#ftpfolder
- '''
- IF THE LEGACY DRIVER IS SELECTED THE OBJECT SHOULD USE NVOLDADDR
- '''
- def nvaddress(self):
- #if self.details['drvtype'] == 'oldest':#ONLY for the Legacy driver
- # wsite = ' http://download.nvidia.com/XFree86/'
- #else:#for latest and newlegacy
- wsite = ' http://us.download.nvidia.com/XFree86/'
- nvweb = wsite + self.details['nvftpdir'] + '/' + self.details['drvname']
- self.details['website'] = nvweb
-
-
- def atiaddress(self):
- if self.details['drvtype'] == 'oldest' and self.details['arch'] == 'x86_64':#ONLY for the Legacy driver
- #if self.details['arch'] == 'x86_64':#only the 64bit of 8.28.8 is in a different folder
- atiweb = ' https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux/64bit/' + self.details['drvname']
- else: atiweb = ' https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux/' + self.details['drvname']
- self.details['website'] = atiweb
-
- def md5get(self):
- cksum = os.popen('md5sum ' + self.details['driverpath'] + self.details['drvname'])
- pat1 = re.compile('(.+) (.*)\n')
- optext = cksum.readlines()
- for line in optext:
- m1 = pat1.match(line)
- md5 = m1.group(1).strip()
- if m1:
- self.details['md5new'] = md5
-
- def getdriver(self):
- if self.details['cardbrand'] == 'nvidia':
- if self.details['drvtype'] == 'oldest':
- self.details['driverpath'] = '/usr/share/envy/nvidia-graphics-drivers-legacy/'
- else:
- self.details['driverpath'] = '/usr/share/envy/nvidia-graphics-drivers/'
- else:#if ATI
- self.details['driverpath'] = '/usr/share/envy/'
- driverlocation = self.details['driverpath'] + self.details['drvname']
- driverexists = os.path.isfile(driverlocation)
- if driverexists:
- print 'An installer has been detected'
- self.md5get()
- print 'md5new: ' + self.details['md5new']#md5new
- print 'md5sumold: ' + self.details['md5old']
- if self.details['md5new'] != self.details['md5old']: #md5new
- print 'ENVY ERROR: md5 Error! Trying to fetch the driver from the website'
- os.remove(self.details['driverpath'] + self.details['drvname'])
- self.getdriver()#CHECK
- else:#If the driver installer can't be found on your hard disk
- print 'No installer detected'
- print 'Download of the driver in progress, please wait'
- os.system('cd ' + self.details['driverpath'] + '&& sudo wget -c --tries=2 --timeout=20 --no-check-certificate' + self.details['website'])
- self.md5get()
- print 'md5new: ' + self.details['md5new']#md5new
- print 'md5sumold: ' + self.details['md5old']
- if self.details['md5new'] != self.details['md5old']:
- print 'ENVY ERROR: md5 Error! Operation aborted'
- sys.exit()
-
- def atipkgmake(self):
- a = os.uname()[2]
- b = list(a)
- c1 = a[0:6]
- c = c1.strip()
- kernels1 = ['2.6.13', '2.6.12', '2.6.11', '2.6.10', '2.6.14', '2.6.15', '2.6.16', '2.6.17', '2.6.18', '2.6.19']
- kernels2 = ['2.6.20', '2.6.21', '2.6.22']#needs the patch
- if self.details['osname'] not in self.legacyos:#only dapper and etch use bash
- os.system('sudo ln -sf /bin/bash /bin/sh')#can cause problems on Dapper
- #if c in kernels1:
- #if self.details['osname'] == 'edgy':
- os.system('sh ' + self.details['drvname'] + ' --buildpkg Ubuntu/' + self.details['osname'])#name of the installer, dapper or edgy
- #elif self.details['osname'] == 'feisty':#TEMPORARY FIX
- #else:#needs the patch
- os.system('sudo ln -sf /bin/dash /bin/sh')#can cause problems on Dapper
- else:
- os.system('sh ' + self.details['drvname'] + ' --buildpkg Ubuntu/' + self.details['osname'])#name of the installer, dapper or edgy
-
-
- '''SCRIVERE ATIPKG INSTALL'''
- def atipkginstall(self):
- drvname = self.details['drvname']
- #print 'Using version: ' + drvname#Rimuovere
- os.system('sudo dpkg -i *.deb')
- #os.system('sudo dpkg -i xorg-driver-fglrx_' + drvname + '*.deb')
- #os.system('sudo dpkg -i fglrx-kernel-source_' + drvname + '*.deb')
- #os.system('sudo dpkg -i fglrx-control_' + drvname + '*.deb')
-
- def atirmdeb(self):
- #Remove any old fglrx debs from /usr/src/:
- os.system('sudo rm /usr/src/fglrx-kernel*.deb')
-
- def atikmod(self):#compile ATI kernel module
- os.system('sudo module-assistant prepare')
- os.system('sudo module-assistant update')
- os.system('sudo module-assistant build fglrx')
- os.system('sudo module-assistant install fglrx')
- os.system('sudo depmod -a')
-
- def nvkernelcontrol(self):#ONLY FOR nvidiaclean
- a = os.uname()[2]
- b = list(a)
- c1 = a[0:6]
- c = c1.strip()
- kernels1 = ['2.6.13', '2.6.12', '2.6.11', '2.6.10']#gcc-3.4
- kernels2 = ['2.6.14', '2.6.15', '2.6.16', '2.6.17', '2.6.18', '2.6.19', '2.6.20']#gcc-4.0 or 4.1
- systemname = self.details['osname']
- if systemname == 'dapper':
- if c in kernels1:
- os.system('sudo ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc')
- elif c in kernels2:
- os.system('sudo ln -sf /usr/bin/gcc-4.0 /usr/bin/gcc')
- if systemname == 'edgy' or systemname == 'etch':
- if c in kernels1:
- os.system('sudo ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc')
- elif c in kernels2:
- os.system('sudo ln -sf /usr/bin/gcc-4.1 /usr/bin/gcc')
-
- d = '/usr/src/' + 'kernel-headers-' + a#kernel headers path
- f = '/usr/lib/xorg/modules'#xorg 32bit modules path
- g = '/usr/lib64/xorg/modules'#xorg 64bit modules path
- if os.path.isdir(d):
- '''If the kernel is recompiled'''
- print 'Recompiled kernel detected'
- #self.details['kerneltype'] = 'recompiled'#THE KERNEL IS RECOMPILED
- z = d + '/arch/i386/'
- if not os.path.isdir(z):
- os.system('sudo mkdir -p' + ' ' + z)
- if not os.path.isfile(z + 'Makefile.cpu'):
- '''If the Makefile.cpu does not exist'''
- if self.details['arch'] == 'x86_64':
- main.addmakefile64()
- else: main.addmakefile32()
- os.system('cd ' + d + ' && ' + 'sudo make prepare' + ' && ' + 'sudo make prepare scripts')
- if not os.path.isfile(z + 'Makefile.cpu'):
- '''If the Makefile.cpu still does not exist'''
- print 'ENVY ERROR: Makefile.cpu not found!'
- sys.exit()
- if self.details['arch'] == 'x86_64':
- '''For Ubuntu 64bit'''
- #os.system('cd ' + foldername + ' && ' + 'sudo ./nvidia-installer -n -s --x-prefix=' + g + ' --kernel-source-path=' + d)
- os.system('sudo sh ' + self.details['drvname'] + ' -n -s --x-prefix=' + g + ' --kernel-source-path=' + d)
- else:
- os.system('sudo sh ' + self.details['drvname'] + ' -n -s --x-prefix=' + f + ' --kernel-source-path=' + d)
- else:
- '''For Ubuntu default kernels'''
- #self.details['kerneltype'] = 'default'#THE KERNEL IS NOT RECOMPILED
- e = '/usr/src/' + 'linux-headers-' + a
- if self.details['arch'] == 'x86_64':
- '''For Ubuntu 64bit'''
- os.system('sudo sh ' + self.details['drvname'] + ' -n -s --x-prefix=' + g + ' --kernel-source-path=' + e)
- else:
- os.system('sudo sh ' + self.details['drvname'] + ' -n -s --x-prefix=' + f + ' --kernel-source-path=' + e)
- os.system('sudo depmod -a')#DEPMOD
-
- def newkernelcontrol(self):
- a = os.uname()[2]
- b = list(a)
- c1 = a[0:6]
- c = c1.strip()
- kernels1 = ['2.6.13', '2.6.12', '2.6.11', '2.6.10']#gcc-3.4
- kernels2 = ['2.6.14', '2.6.15', '2.6.16', '2.6.17', '2.6.18', '2.6.19', '2.6.20']#gcc-4.0 or 4.1
- systemname = self.details['osname']
- if systemname == 'dapper':
- if c in kernels1:
- os.system('sudo ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc')
- elif c in kernels2:
- os.system('sudo ln -sf /usr/bin/gcc-4.0 /usr/bin/gcc')
- if systemname == 'edgy':
- if c in kernels1:
- os.system('sudo ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc')
- elif c in kernels2:
- os.system('sudo ln -sf /usr/bin/gcc-4.1 /usr/bin/gcc')
-
- d = '/usr/src/' + 'kernel-headers-' + a#kernel headers path
- f = '/usr/lib/xorg/modules'#xorg 32bit modules path
- g = '/usr/lib64/xorg/modules'#xorg 64bit modules path
- if os.path.isdir(d):
- '''If the kernel is recompiled'''
- print 'Recompiled kernel detected'
- #self.details['kerneltype'] = 'recompiled'#THE KERNEL IS RECOMPILED
- z = d + '/arch/i386/'
- if not os.path.isdir(z):
- os.system('sudo mkdir -p' + ' ' + z)
- if not os.path.isfile(z + 'Makefile.cpu'):
- '''If the Makefile.cpu does not exist'''
- if self.details['arch'] == 'x86_64':
- main.addmakefile64()
- else: main.addmakefile32()
- os.system('cd ' + d + ' && ' + 'sudo make prepare' + ' && ' + 'sudo make prepare scripts')
- if not os.path.isfile(z + 'Makefile.cpu'):
- '''If the Makefile.cpu still does not exist'''
- print 'ENVY ERROR: Makefile.cpu not found!'
- sys.exit()
-
-
- def nvuninstalling(self):
- if self.details['drvtype'] == 'oldest':
- nvdistinction = 'nvidia-graphics-drivers-legacy'
- else:
- nvdistinction = 'nvidia-graphics-drivers'
- os.system('cd /usr/share/envy/' + nvdistinction + '/ && sudo sh ' + self.details['drvname'] + ' --uninstall')
- '''UBUNTU AMD64 CHECK'''
- '''Remove the makefile.cpu'''
- #rmmakefile()
- if self.details['osname'] != 'etch':
- os.system('sudo apt-get -y install --reinstall linux-restricted-modules-`uname -r`')
- '''
- USE main.remove_ati_pkg()
- def atiuninstalling():
- os.system('sudo sh ' + self.details['drvname'] + ' --uninstall')
- UBUNTU AMD64 CHECK
- Remove the makefile.cpu
- #rmmakefile()
- os.system('sudo aptitude reinstall linux-restricted-modules-`uname -r`')
- '''
-
- def xorgbackup(self):
- os.system('sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup_`date +%Y%m%d%H%M`')
-
-
- def restoregcc(self):
- a = os.uname()[2]
- b = list(a)
- c1 = a[0:6]
- c = c1.strip()
- kernels1 = ['2.6.13', '2.6.12', '2.6.11', '2.6.10']#gcc-3.4
- kernels2 = ['2.6.14', '2.6.15', '2.6.16', '2.6.17', '2.6.18', '2.6.19', '2.6.20']#gcc-4.0 or 4.1
- systemname = self.details['osname']
- if systemname == 'dapper':
- if c in kernels1:
- os.system('sudo ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc')
- elif c in kernels2:
- os.system('sudo ln -sf /usr/bin/gcc-4.0 /usr/bin/gcc')
- if systemname == 'edgy' or systemname == 'etch':
- if c in kernels1:
- os.system('sudo ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc')
- elif c in kernels2:
- os.system('sudo ln -sf /usr/bin/gcc-4.1 /usr/bin/gcc')
-
- def nviconadd(self):
- try:
- shutil.copy('/usr/share/envy/nvidia-settings.desktop', '/usr/share/applications/')
- except OSError:
- pass
-
- def nviconrm(self):
- a = os.path.isfile('/usr/share/applications/nvidia-settings.desktop')
- try:
- os.remove('/usr/share/applications/nvidia-settings.desktop')
- except OSError:
- pass
-
- def nvxorgset(self):
- distrolst = ['edgy', 'etch', 'feisty']#THEY NEED COMPOSITE TO BE ENABLED ATM
- systemname = self.details['osname']
- if systemname in distrolst:
- if self.details['drvtype'] == 'latest' or self.details['drvtype'] == 'middle':
- os.system('sudo /usr/bin/nvidia-xconfig --composite')#MAKE SURE that COMPOSITE is ENABLED
- #objects.removeaiglx()#just in case it was disabled
- try:
- if self.details['geforcego'] == 'true':#needed by geforce go 420 440
- os.system('sudo /usr/share/envy/legacy/nvidia-xconfig --use-display-device=DFP')
- except KeyError:
- pass
- else:
- os.system('sudo /usr/share/envy/legacy/nvidia-xconfig --no-composite')#MAKE SURE that COMPOSITE is DISABLED
- #objects.disableaiglx()#disable AIGLX
- else: os.system('sudo /usr/share/envy/legacy/nvidia-xconfig')#for Dapper
-
-
- def atixorgset(self):
- distrolst = ['edgy', 'etch', 'feisty']#THEY NEED COMPOSITE and AIGLX TO BE DISABLED ATM
- systemname = self.details['osname']
- objects.disablecomposite()
- #objects.disableaiglx()#disable AIGLX
- #os.system('sudo aticonfig --initial --force')
- #os.system('sudo aticonfig --overlay-type=Xv')
- runme = Fglrx()
- runme.file = '/etc/X11/xorg.conf'
- runme.atifglrx()
-
-
-
- class Fglrx:
- def atifglrx(self):
- drvlst = ['fbdev', 'vga', 'vesa', 'radeon', 'ati', 'fglrx']
- #self.file = '/home/alberto/Desktop/xorg.prova'
- lines = []
- #pat2 = re.compile('.*Option.*\"Composite\".*\"(.+)\".*\n')
- text = open(self.file, 'r')
- optext = text.readlines()
- pat1 = re.compile('.*Driver.*\"(.+)\".*\n')
- for line in optext:
- m1 = pat1.match(line)
- #m2 = pat2.match(line)
- if m1:
- drvstring = m1.group(1).strip()
- if drvstring in drvlst:
- line = '\tDriver\t\"fglrx\"\n'
- lines.append(line)
- #elif m2:
- # line = '>'#a bookmark to find the 3rd line we need to delete
- # lines.append(line)
- else:
- lines.append(line)
- text.close()
- sep = ''
- modtext = open(self.file, 'w')
- a = sep.join(lines)
- modtext.write(a)
- modtext.close()
-
- lines1 = []
- text1 = open(self.file, 'r')
- optext1 = text1.readlines()
- pat2 = re.compile('.*Option.*\"VideoOverlay\".*\".+\".*\n')
- pat3 = re.compile('.*Option.*\"OpenGLOverlay\".*\".+\".*\n')
- for line in optext1:
- m2 = pat2.match(line)
- m3 = pat3.match(line)
- if m2:
- line = ''
- lines1.append(line)
- elif m3:
- line = ''#a bookmark to find the 3rd line we need to delete
- lines1.append(line)
- else:
- lines1.append(line)
- text1.close()
- sep = ''
- modtext1 = open(self.file, 'w')
- a = sep.join(lines1)
- modtext1.write(a)
- modtext1.close()
-
- lastlines = []
- lasttext = open(self.file, 'r')
- newtext = lasttext.readlines()
- pat4 = re.compile('.*Driver.*\"fglrx\".*\n')#removes what remains of the option
- for lastline in newtext:
- m4 = pat4.match(lastline)
- if m4:
- lastline = '\tDriver\t\"fglrx\"\n\tOption\t\"VideoOverlay\" \"on\"\n\tOption\t\"OpenGLOverlay" "off"\n'
- lastlines.append(lastline)
- else: lastlines.append(lastline)
- lasttext.close()
- modtext2 = open(self.file, 'w')
- b = sep.join(lastlines)
- modtext2.write(b)
- modtext2.close()
-
-
- class Composite:#removes any trace of the Composite Extension
-
- def operate(self):
- lines = []
- pat1 = re.compile('.*Section.*\"Extensions\".*\n')
- pat2 = re.compile('.*Option.*\"Composite\".*\"(.+)\".*\n')
- text = open(self.file, 'r')
- optext = text.readlines()
- for line in optext:
- m1 = pat1.match(line)
- m2 = pat2.match(line)
- if m1:
- line = ''
- lines.append(line)
- elif m2:
- line = '>'#a bookmark to find the 3rd line we need to delete
- lines.append(line)
- else:
- lines.append(line)
- text.close()
- sep = ''
- modtext = open(self.file, 'w')
- a = sep.join(lines)
- modtext.write(a)
- modtext.close()
-
- lastlines = []
- lasttext = open(self.file, 'r')
- newtext = lasttext.readlines()
- pat3 = re.compile('>.*EndSection.*\n')#removes what remains of the option
- for lastline in newtext:
- m3 = pat3.match(lastline)
- if m3:
- lastline = ''
- lastlines.append(lastline)
- else: lastlines.append(lastline)
- lasttext.close()
- modtext1 = open(self.file, 'w')
- b = sep.join(lastlines)
- modtext1.write(b)
- modtext1.close()
-
- class Compositechoice:
- #def init():
- # self.file = 'none'#the address of the file
- # self.operation = 'none'#Disable or Enable
-
- def choosecomposite(self):#Enable or Disable Composite
- objects.removecomposite()
- file = open(self.file, 'a')
- option = '\nSection "Extensions"\n\tOption "Composite" "' + self.operation + '"\nEndSection\n\n'
- file.write(option)
- file.close()
-
- class Aiglx:#removes any trace of the Composite Extension
-
- def operate(self):
- lines = []
- pat1 = re.compile('.*Section.*\"ServerFlags\".*\n')
- pat2 = re.compile('.*Option.*\"AIGLX\".*\"(.+)\".*\n')
- text = open(self.file, 'r')
- optext = text.readlines()
- for line in optext:
- m1 = pat1.match(line)
- m2 = pat2.match(line)
- if m1:
- line = ''
- lines.append(line)
- elif m2:
- line = '>'#a bookmark to find the 3rd line we need to delete
- lines.append(line)
- else:
- lines.append(line)
- #if m1:
- # line = '>'
- # lines.append(line)
- #elif m2:
- # line = '>'#a bookmark to find the 3rd line we need to delete
- # lines.append(line)
- text.close()
- sep = ''
- modtext = open(self.file, 'w')
- a = sep.join(lines)
- modtext.write(a)
- modtext.close()
-
- lastlines = []
- lasttext = open(self.file, 'r')
- newtext = lasttext.readlines()
- pat3 = re.compile('>.*EndSection.*\n')#removes what remains of the option
- pat4 = re.compile('>.*\n')#removes what remains of the option
- for lastline in newtext:
- m3 = pat3.match(lastline)
- #m4 = pat4.match(lastline)
- if m3:
- lastline = ''
- lastlines.append(lastline)
- #elif m4:
- else: lastlines.append(lastline)
- lasttext.close()
- modtext1 = open(self.file, 'w')
- b = sep.join(lastlines)
- modtext1.write(b)
- modtext1.close()
-
- class Aiglxchoice:
- #def init():
- # self.file = 'none'#the address of the file
- # self.operation = 'none'#Disable or Enable
-
- def chooseaiglx(self):#Enable or Disable AIGLX
- objects.removeaiglx()
- file = open(self.file, 'a')
- option = '\nSection "ServerFlags"\n\tOption "AIGLX" "' + self.operation + '"\nEndSection\n\n'
- file.write(option)
- file.close()
-
- '''DE\BLACKLIST FGLRX OR NVIDIA'''
- class Chooselist:
- def init(self):
- self.driver = 'none'#'fglrx', 'nvidia' or ''
- def blacklist(self):
- '''restore Ubuntu original linux-restricted-modules-common'''
- restrictedblk = open('/etc/default/linux-restricted-modules-common', 'w')
- restrictedblk.write('# This file is sourced from the linux-restricted-modules-common init\n\
- # script and is used to disable the link-on-boot feature, one module\n\
- # at a time. This can be useful if you want to use hand-compiled\n\
- # versions of one or more modules, but keep linux-restricted-modules\n\
- # installed on your system, or just to disable modules you don\'t use\n\
- # and speed up your boot process by a second or two.\n\
- #\n\
- # Use a space-separated list of modules you wish to not have linked\n\
- # on boot. The following example shows a (condensed) list of all\n\
- # modules shipped in the linux-restricted-modules packages:\n\
- #\n\
- # DISABLED_MODULES="ath_hal fc fglrx ltm nv"\n\
- #\n\
- # Note that disabling "fc" disables all fcdsl drivers, "ltm" disables\n\
- # ltmodem and ltserial, and "nv" disables both the nvidia drivers.\n\
- # You can also name each module individually, if you prefer a subset.\n\
- \n\
- DISABLED_MODULES="' + self.driver + '"\n')
- restrictedblk.close()
-