This file is indexed.

/usr/share/pyshared/firmware_addon_dell/dellbios.py is in firmware-addon-dell 2.2.9-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# vim:tw=0:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:

  #############################################################################
  #
  # Copyright (c) 2005 Dell Computer Corporation
  # Dual Licenced under GNU GPL and OSL
  #
  #############################################################################
"""module

some docs here eventually.
"""

from __future__ import generators

# import arranged alphabetically
import commands
import os

# local modules
import biosHdr
import firmwaretools.package as package
import firmwaretools.plugins as plugins

plugin_type = (plugins.TYPE_INVENTORY,)
requires_api_version = "2.0"

rbu_load_error="""Could not load Dell RBU kernel driver (dell_rbu).
This kernel driver is included in Linux kernel 2.6.14 and later.
For earlier releases, you can download the dell_rbu dkms module.

Cannot continue, exiting...
"""

bios_update_error="""Could not update the system BIOS.

Many times, this is due to memory constraints. The BIOS update can require from
1 to 4 megabytes of physically contiguous free RAM in order to do the update.
Because memory can become fragmented, this is not always available. To correct
this, try rebooting and running the update immediately after reboot.

The output from the low-level bios update command was:

%s
"""

class BiosPackage(package.RepositoryPackage):
    def __init__(self, *args, **kargs):
        super(BiosPackage, self).__init__(*args, **kargs)
        self.compareStrategy = biosHdr.compareVersions
        self.capabilities['can_downgrade'] = True
        self.capabilities['can_reflash'] = True

    def install(self):
        self.status = "in_progress"
        override=""
        # only activate override in cases where it is needed.
        installDevice = self.getCurrentInstallDevice()
        #print "BiosPackage DEBUG: %s" % self.compareVersion(installDevice)
        if self.compareVersion(installDevice) <= 0:   # activate for downgrade and reflash
            override="--override_bios_version"
        instStr = """dellBiosUpdate %s -u -f %s""" % (override, os.path.join(self.path, "bios.hdr"))
        #print "BiosPackage: %s" % instStr

        ret = os.system("/sbin/modprobe dell_rbu")
        if ret:
            return (0, rbu_load_error)
        status, output = commands.getstatusoutput(instStr)
        if status:
            self.status = "failed"
            raise package.InstallError(bios_update_error % output)

        self.status = "warm_reboot_needed"
        return 1


sysId = 0
try:
    sysId = biosHdr.getSystemId()
except Exception, e:
    pass

def config_hook(conduit, inventory=None, *args, **kargs):
    if sysId:
        base = conduit.getBase()
        base.setSystemId( vendorId = 0x1028, systemId = sysId )

def inventory_hook(conduit, inventory=None, *args, **kargs):
    if sysId:
        base = conduit.getBase()
        cb = base.cb
        biosVer = biosHdr.getSystemBiosVer()
        p = package.Device(
            name = ("system_bios(ven_0x1028_dev_0x%04x)" % sysId).lower(),
            displayname = "System BIOS for %s" % biosHdr.getProductName(),
            version = biosVer,
            compareStrategy = biosHdr.compareVersions,
            )

        if inventory.getDevice(p.uniqueInstance) is None:
            inventory.addDevice(p)

#==============================================================
# mock classes for unit tests
#   plus expected data returns
#==============================================================

# re-use mock data from low-level getSystemId mock function
mockExpectedOutput_inventory = [("system_bios(ven_0x1028_dev_0x0183)", "a05"), ]

#==============================================================
# mock classes for unit tests
#   plus expected data returns
#==============================================================

# re-use mock data from low-level getSystemId mock function
mockExpectedOutput_bootstrap = """system_bios(ven_0x1028_dev_0x0183)"""