Пример #1
0
    def installNvidiaDriver(self, packageList):
        try:
            # Remove certain packages before installing the drivers
            for package in packageList:
                if package[1] == 1:
                    if functions.isPackageInstalled(package[0]):
                        self.log.write('Remove package: ' + package[0], 'nvidia.installNvidiaDriver', 'debug')
                        self.ec.run('apt-get -y --force-yes remove ' + package[0])

            # Preseed answers for some packages
            self.preseedNvidiaPackages('install')

            # Install the packages
            installString = ''
            notInRepo = ''
            for package in packageList:
                chkStatus = functions.getPackageStatus(package[0])
                if chkStatus != packageStatus[2]:
                    installString += ' ' + package[0]
                elif package[1] != 2:
                    notInRepo += ', ' + package[0]

            if notInRepo == '':
                self.ec.run('apt-get -y --force-yes install' + installString)
            else:
                self.log.write('Install aborted: not in repository: ' + notInRepo[2:], 'nvidia.installNvidiaDriver', 'error')

        except Exception, detail:
            self.log.write(detail, 'nvidia.installNvidiaDriver', 'exception')
Пример #2
0
    def getPae(self):
        hwList = []

        # Ubuntu is already PAE enabled from version 12.10 (Quantal) and LM 14 Nadia is based on Quantal: no need to check
        # https://help.ubuntu.com/community/EnablingPAE
        self.log.write('Distribution: ' + self.distribution + ' ' + str(self.distributionReleaseNumber), 'pae.getPae', 'debug')
        skipPae = False
        if (self.distribution == 'linuxmint' and self.distributionReleaseNumber >= 14) or (self.distribution == 'ubuntu' and self.distributionReleaseNumber >= 12.10):
            skipPae = True

        if not skipPae:
            # Get the kernel release
            kernelRelease = self.ec.run('uname -r')
            # Check the machine hardware
            machine = self.ec.run('uname -m')

            if not 'amd64' in kernelRelease[0]:
                if not 'pae' in kernelRelease[0]:
                    self.log.write('Single-core kernel found: ' + kernelRelease[0], 'pae.getPae', 'debug')

                    # Get #CPU's: cat /proc/cpuinfo | grep processor | wc -l
                    if machine[0] == 'i686':
                        self.log.write('Multi-core system running single-core kernel found', 'pae.getPae', 'info')
                        # Check package status
                        status = packageStatus[0]
                        for package in self.packages:
                            if not functions.isPackageInstalled(package):
                                self.log.write('PAE not installed', 'pae.getPae', 'info')
                                status = packageStatus[1]
                                break
                        hwList.append(['Multi-core support for 32-bit systems', hwCodes[3], status])
                    elif machine[0] == 'x86_64':
                        self.log.write('PAE skipped: 64-bit system', 'pae.getPae', 'debug')
                    else:
                        self.log.write('PAE kernel cannot be installed: single-core system', 'pae.getPae', 'warning')

                else:
                    self.log.write('Multi-core already installed: ' + kernelRelease[0], 'pae.getPae', 'info')
                    hwList.append(['Multi-core support for 32-bit systems', hwCodes[3], packageStatus[0]])

        return hwList
Пример #3
0
    def getFastestMirror(self):
        mirList = []
        if self.distribution == 'debian':
            # Check if mint-debian-mirrors is installed
            if functions.isPackageInstalled('mint-debian-mirrors'):
                # Get the mirrors
                cmd = 'mint-choose-debian-mirror --dry-run'
                mirrors = self.ec.run(cmd)
                for mirror in mirrors:
                    # Extract the url
                    urlObj = re.search('http[a-zA-Z0-9:\.\-/]*', mirror)
                    if urlObj:
                        url = urlObj.group()
                        if 'current server' in mirror.lower():
                            self.log.write('Current server: ' + url, 'mirror.getFastestMirror', 'info')
                            self.currentMirror = url
                        elif 'best server' in mirror.lower():
                            self.log.write('Best server: ' + url, 'mirror.getFastestMirror', 'info')
                            self.bestMirror = url
                    else:
                        self.log.write('No mirror URL found', 'mirror.getFastestMirror', 'warning')
            else:
                self.log.write('Cannot detect fastest mirror: mint-debian-mirrors not installed', 'mirror.getFastestMirror', 'warning')
        else:
            # TODO: do this for Ubuntu
            pass

        # Append fastest mirror to list
        status = packageStatus[2]
        if self.bestMirror != '':
            if self.bestMirror == self.currentMirror:
                status = packageStatus[0]
            else:
                status = packageStatus[1]
            mirList.append(['Install the fastest repository mirror', hwCodes[4], status])

        return mirList
Пример #4
0
    def installBroadcom(self):
        try:
            self.setCurrentChipInfo()
            if self.installableDriver != '':
                # Get the correct linux header package
                linHeader = functions.getLinuxHeadersAndImage()
                self.log.write('Linux header name to install: ' + linHeader[0], 'broadcom.installBroadcom', 'info')

                # Only install linux header if it is not installed
                if not functions.isPackageInstalled(linHeader[0]):
                    self.log.write('Download package: ' + linHeader[0], 'broadcom.installBroadcom', 'info')
                    self.ec.run('apt-get download ' + linHeader[0])

                # Download the driver and its dependencies
                cmdBc = 'apt-get download ' + self.installableDriver
                self.log.write('Download package: ' + self.installableDriver, 'broadcom.installBroadcom', 'info')
                self.ec.run(cmdBc)
                depList = functions.getPackageDependencies(self.installableDriver)
                for dep in depList:
                    if not functions.isPackageInstalled(dep):
                        cmdDep = 'apt-get download ' + dep
                        self.log.write('Download package dependency: ' + dep, 'broadcom.installBroadcom', 'debug')
                        self.ec.run(cmdDep)

                # Remove any module that might be in the way
                self.log.write('modprobe b44, b43, b43legacy, ssb, brcmsmac', 'broadcom.installBroadcom', 'debug')
                os.system('modprobe -rf b44')
                os.system('modprobe -rf b43')
                os.system('modprobe -rf b43legacy')
                os.system('modprobe -rf ssb')
                os.system('modprobe -rf brcmsmac')

                # Install the dowloaded packages
                self.log.write('Install downloaded packages', 'broadcom.installBroadcom', 'info')
                self.ec.run('dpkg -i *.deb')
                # Delete the downloaded packages
                self.log.write('Remove downloaded debs', 'broadcom.installBroadcom', 'debug')
                os.system('rm -f *.deb')

                # Finish up
                if self.installableDriver == 'broadcom-sta-dkms' or self.installableDriver == 'bcmwl-kernel-source':
                    # Blacklist b43, brcmsmac
                    self.log.write('blacklist b43 brcmsmac bcma ssb', 'broadcom.installBroadcom', 'debug')
                    modFile = open(blacklistPath, 'w')
                    modFile.write('blacklist b43 brcmsmac bcma ssb')
                    modFile.close()
                    # Start wl
                    self.log.write('modprobe wl', 'broadcom.installBroadcom', 'debug')
                    os.system('modprobe wl')
                elif 'b43' in self.installableDriver:
                    # Start b43
                    self.log.write('modprobe b43', 'broadcom.installBroadcom', 'debug')
                    os.system('modprobe b43')
                else:
                    # Start brcmsmac
                    self.log.write('modprobe brcmsmac', 'broadcom.installBroadcom', 'debug')
                    os.system('modprobe brcmsmac')

                self.log.write('Done installing Broadcome drivers', 'broadcom.installBroadcom', 'info')
            else:
                self.log.write('No Broadcom chip set found', 'broadcom.installBroadcom', 'error')

        except Exception, detail:
            self.log.write(detail, 'broadcom.installBroadcom', 'exception')
Пример #5
0
 def on_btnHelp_clicked(self, widget):
     if functions.isPackageInstalled("firefox"):
         system("firefox file://%s &" % self.help)
     else:
         system("xdg-open file://%s &" % self.help)
Пример #6
0
log = Logger(logFile)
functions.log = log
if debug:
    if os.path.isfile(log.logPath):
        open(log.logPath, 'w').close()
    log.write('Write debug information to file: ' + log.logPath, 'main', 'info')

# Log some basic environmental information
machineInfo = functions.getSystemVersionInfo()
log.write('Machine info: ' + machineInfo, 'main', 'info')
version = functions.getPackageVersion('device-driver-manager')
log.write('DDM version: ' + version, 'main', 'info')

# There were issues with apt-listbugs
# Warn the user for any errors that might accur when apt-listbugs is installed
if functions.isPackageInstalled('apt-listbugs'):
    log.write('apt-listbugs is installed and might interfere with driver installation', 'main', 'warning')

# Set variables
scriptDir = os.path.dirname(os.path.realpath(__file__))

# Pass arguments to ddm.py: replace - with : -> because kdesudo assumes these options are meant for him...
# TODO: Isn't there another way?
args = ' '.join(sys.argv[1:])
if len(args) > 0:
    args = ' ' + string.replace(args, '-', ':')
    # Pass the log path to ddm.py
    if debug:
        args += ' :l ' + log.logPath

if not functions.getDistribution() == '':