def needHDDFormat(): internalHdd = getInternalHDD() if not internalHdd: return False if internalHdd.numPartitions() != 1: return True internalHddName = internalHdd.getDeviceName() hddPathName, hddBaseName = os.path.split(internalHddName) for p in getPartitionNames(): if p.startswith(hddBaseName) and p[len(hddBaseName):].isdigit(): fsType = getFsType(os.path.join(hddPathName, p)) if fsType: break if fsType and fsType in ("ext3", "ext4"): return False return True
def populate2(self): self.list = [] self.list.append(self.makeHeadingInfoEntry(_("Model:"), "%s %s" % (getMachineBrand(), getMachineName()))) self.list.append(self.makeEmptyEntry()) self.list.append(self.makeHeadingEntry(_("Detected Tuners:"))) nims = nimmanager.nimList() for count in range(min(len(nims), 4)): self.list.append(self.makeInfoEntry(*nims[count].split(": "))) self.list.append(self.makeEmptyEntry()) self.list.append(self.makeHeadingEntry(_("Detected HDDs and Volumes:"))) partitions = getPartitionNames() partitions.sort() mounts = getProcMounts() mountIndex = {} for m in mounts: x = m[0] if x.startswith('/dev/'): x = x[5:] mountIndex[x] = m self.mountinfo = [] for hddtup in harddiskmanager.HDDList(): hdd = hddtup[1] self.mountinfo.append(self.makeHDDEntry(hdd.dev_path, hdd.model(), self.sizeStr(hdd.diskSize()))) for part in [p for p in partitions if p.startswith(hdd.device)]: if part in mountIndex: mount = mountIndex[part] fs = mount[2] if fs: fs = fs.upper() else: fs = "Unknown" fsType = mount[2] if fsType in Devices.fsNameMap: fsType = Devices.fsNameMap[fsType] self.mountinfo += self.mountInfo(mount[0], mount[1], fsType) else: self.mountinfo.append(self.makeInfoEntry(part, _('Not mounted'))) if not self.mountinfo: self.mountinfo.append(self.makeHDDEntry(_('none'), '', '')) self.list += self.mountinfo self.mountinfo = [] self.list.append(self.makeEmptyEntry()) self.list.append(self.makeHeadingEntry(_("Network Servers:"))) for mount in [m for m in mounts if match(Devices.FSTABIPMATCH, m[0])]: self.mountinfo += self.mountInfo(mount[0], mount[1], mount[2].upper(), twoLines=True) try: for mountname in listdir('/media/autofs'): mountpoint = path.join('/media/autofs', mountname) self.mountinfo += self.mountInfo(mountpoint, mountpoint, 'AUTOFS', twoLines=True) except Exception, e: print "[Devices] find autofs mounts:", e