Exemple #1
0
 def onRemoteRootFS(self):
     if self.remoteRootFS is None:
         from Components.Harddisk import getProcMounts
         for parts in getProcMounts():
             if parts[1] == '/' and parts[2] == 'nfs':
                 self.remoteRootFS = True
                 break
         else:
             self.remoteRootFS = False
     return self.remoteRootFS
Exemple #2
0
def CheckMountDir(device):
	hdd = "nothing"
	movie = "nothing"
	from Components.Harddisk import getProcMounts
	mounts = getProcMounts()
	for line in mounts:
		if line[1][-3:] == "hdd":
			hdd = GetDeviceFromList(device, line[0][5:])
		elif line[1][-5:] == "movie":
			movie = GetDeviceFromList(device, line[0][5:])
	return hdd, movie
Exemple #3
0
	def doCreateSwap(self):
		parts = []
		supported_filesystems = frozenset(('ext4', 'ext3', 'ext2', 'vfat'))
		candidates = []
		mounts = getProcMounts() 
		for partition in harddiskmanager.getMountedPartitions(False, mounts):
			if partition.filesystem(mounts) in supported_filesystems:
				candidates.append((partition.description, partition.mountpoint)) 
		if len(candidates):
			self.session.openWithCallback(self.doCSplace, ChoiceBox, title = _("Please select device to use as swapfile location"), list = candidates)
		else:
			self.session.open(MessageBox, _("Sorry, no physical devices that supports SWAP attached. Can't create Swapfile on network or fat32 filesystems"), MessageBox.TYPE_INFO, timeout = 10)
Exemple #4
0
	def doCreateSwap(self):
		parts = []
		supported_filesystems = frozenset(("ext4", "ext3", "ext2"))
		candidates = []
		mounts = getProcMounts()
		for partition in harddiskmanager.getMountedPartitions(False, mounts):
			if partition.filesystem(mounts) in supported_filesystems:
				candidates.append((partition.description, partition.mountpoint))
		if len(candidates):
			self.session.openWithCallback(self.doCSplace, ChoiceBox, title=_("Please select device to use as SWAP file location."), list=candidates)
		else:
			self.session.open(MessageBox, _("Sorry, no physical devices that supports SWAP attached. Can't create SWAP file on network or fat32 file-systems."), MessageBox.TYPE_INFO, timeout=10)
	def getMountPointDevice(self, path):
		try:
			from Components.Harddisk import getProcMounts
			procMounts = getProcMounts()
		except:
			# http://git.opendreambox.org/?p=enigma2.git;a=blob;f=usr/lib/enigma2/python/Components/Harddisk.py
			from Components.Harddisk import Util
			procMounts = Util.mtab(virt=False)
		device = ""
		for x in procMounts:
			for entry in x:
				if path == entry:
					device = x[0]
		return device
Exemple #6
0
 def getMountPointDevice(self, path):
     try:
         from Components.Harddisk import getProcMounts
         procMounts = getProcMounts()
     except:
         # http://git.opendreambox.org/?p=enigma2.git;a=blob;f=usr/lib/enigma2/python/Components/Harddisk.py
         from Components.Harddisk import Util
         procMounts = Util.mtab(virt=False)
     device = ""
     for x in procMounts:
         for entry in x:
             if path == entry:
                 device = x[0]
     return device
Exemple #7
0
    def __init__(self, session, menu_path=""):
        AboutBase.__init__(self, session, menu_path)

        out_lines = file("/proc/meminfo").readlines()
        self.list.append(self.makeHeadingEntry(_("RAM")))
        for lidx in range(len(out_lines) - 1):
            tstLine = out_lines[lidx].split()
            if "MemTotal:" in tstLine:
                MemTotal = out_lines[lidx].split()
                self.list.append(
                    self.makeInfoEntry(_("Total Memory:"), MemTotal[1]))
            if "MemFree:" in tstLine:
                MemFree = out_lines[lidx].split()
                self.list.append(
                    self.makeInfoEntry(_("Free Memory:"), MemFree[1]))
            if "Buffers:" in tstLine:
                Buffers = out_lines[lidx].split()
                self.list.append(self.makeInfoEntry(_("Buffers:"), Buffers[1]))
            if "Cached:" in tstLine:
                Cached = out_lines[lidx].split()
                self.list.append(self.makeInfoEntry(_("Cached:"), Cached[1]))
            if "SwapTotal:" in tstLine:
                SwapTotal = out_lines[lidx].split()
                self.list.append(
                    self.makeInfoEntry(_("Total Swap:"), SwapTotal[1]))
            if "SwapFree:" in tstLine:
                SwapFree = out_lines[lidx].split()
                self.list.append(
                    self.makeInfoEntry(_("Free Swap:"), SwapFree[1]))

        FlashTotal = "-"
        FlashFree = "-"
        mounts = getProcMounts()
        if mounts:
            part = Partition(mounts[0][1])
            FlashTotal = self.sizeStr(part.total() / 10**6, _("unknown"))
            FlashFree = self.sizeStr(part.free() / 10**6, _("full"))

        self.list.append(self.makeEmptyEntry())
        self.list.append(self.makeHeadingEntry(_("FLASH")))
        self.list.append(self.makeInfoEntry(_("Total:"), FlashTotal))
        self.list.append(self.makeInfoEntry(_("Free:"), FlashFree))

        self["list"].updateList(self.list)
Exemple #8
0
	def __init__(self, session):
		AboutBase.__init__(self, session)

		out_lines = file("/proc/meminfo").readlines()
		self.list.append(self.makeHeadingEntry(_("RAM")))
		for lidx in range(len(out_lines) - 1):
			tstLine = out_lines[lidx].split()
			if "MemTotal:" in tstLine:
				MemTotal = out_lines[lidx].split()
				self.list.append(self.makeInfoEntry(_("Total Memory:"), MemTotal[1]))
			if "MemFree:" in tstLine:
				MemFree = out_lines[lidx].split()
				self.list.append(self.makeInfoEntry(_("Free Memory:"), MemFree[1]))
			if "Buffers:" in tstLine:
				Buffers = out_lines[lidx].split()
				self.list.append(self.makeInfoEntry(_("Buffers:"), Buffers[1]))
			if "Cached:" in tstLine:
				Cached = out_lines[lidx].split()
				self.list.append(self.makeInfoEntry(_("Cached:"), Cached[1]))
			if "SwapTotal:" in tstLine:
				SwapTotal = out_lines[lidx].split()
				self.list.append(self.makeInfoEntry(_("Total Swap:"), SwapTotal[1]))
			if "SwapFree:" in tstLine:
				SwapFree = out_lines[lidx].split()
				self.list.append(self.makeInfoEntry(_("Free Swap:"), SwapFree[1]))

		FlashTotal = "-"
		FlashFree = "-"
		mounts = getProcMounts()
		if mounts:
			part = Partition(mounts[0][1])
			FlashTotal = self.sizeStr(part.total() / 10 ** 6, _("unavailable"))
			FlashFree = self.sizeStr(part.free() / 10 ** 6, _("full"))

		self.list.append(self.makeEmptyEntry())
		self.list.append(self.makeHeadingEntry(_("FLASH")))
		self.list.append(self.makeInfoEntry(_("Total:"), FlashTotal))
		self.list.append(self.makeInfoEntry(_("Free:"), FlashFree))

		self["list"].updateList(self.list)
Exemple #9
0
 def MemCheck(self):
     memfree = 0
     swapfree = 0
     f = open('/proc/meminfo', 'r')
     for line in f.readlines():
         if line.find('MemFree') != -1:
             parts = line.strip().split()
             memfree = int(parts[1])
         elif line.find('SwapFree') != -1:
             parts = line.strip().split()
             swapfree = int(parts[1])
     f.close()
     TotalFree = memfree + swapfree
     print '[ImageManager] Stage1: Free Mem', TotalFree
     if int(TotalFree) < 3000:
         supported_filesystems = frozenset(('ext4', 'ext3', 'ext2'))
         candidates = []
         mounts = getProcMounts()
         for partition in harddiskmanager.getMountedPartitions(
                 False, mounts):
             if partition.filesystem(mounts) in supported_filesystems:
                 candidates.append(
                     (partition.description, partition.mountpoint))
         for swapdevice in candidates:
             self.swapdevice = swapdevice[1]
         if self.swapdevice:
             print '[ImageManager] Stage1: Creating Swapfile.'
             self.RamChecked = True
             self.MemCheck2()
         else:
             print '[ImageManager] Sorry, not enough free ram found, and no physical devices that supports SWAP attached'
             AddPopupWithCallback(
                 self.BackupComplete,
                 _("Sorry, not enough free ram found, and no physical devices that supports SWAP attached. Can't create Swapfile on network or fat32 filesystems, unable to make backup"
                   ), MessageBox.TYPE_INFO, 10,
                 'RamCheckFailedNotification')
     else:
         print '[ImageManager] Stage1: Found Enough Ram'
         self.RamChecked = True
         self.SwapCreated = True
Exemple #10
0
	def MemCheck(self):
		memfree = 0
		swapfree = 0
		f = open('/proc/meminfo', 'r')
		for line in f.readlines():
			if line.find('MemFree') != -1:
				parts = line.strip().split()
				memfree = int(parts[1])
			elif line.find('SwapFree') != -1:
				parts = line.strip().split()
				swapfree = int(parts[1])
		f.close()
		TotalFree = memfree + swapfree
		print '[ImageManager] Stage1: Free Mem', TotalFree
		if int(TotalFree) < 3000:
			supported_filesystems = frozenset(('ext4', 'ext3', 'ext2'))
			candidates = []
			mounts = getProcMounts()
			for partition in harddiskmanager.getMountedPartitions(False, mounts):
				if partition.filesystem(mounts) in supported_filesystems:
					candidates.append((partition.description, partition.mountpoint))
			for swapdevice in candidates:
				self.swapdevice = swapdevice[1]
			if self.swapdevice:
				print '[ImageManager] Stage1: Creating Swapfile.'
				self.RamChecked = True
				self.MemCheck2()
			else:
				print '[ImageManager] Sorry, not enough free ram found, and no physical devices that supports SWAP attached'
				AddPopupWithCallback(self.BackupComplete,
									 _("Sorry, not enough free ram found, and no physical devices that supports SWAP attached. Can't create Swapfile on network or fat32 filesystems, unable to make backup"),
									 MessageBox.TYPE_INFO,
									 10,
									 'RamCheckFailedNotification'
				)
		else:
			print '[ImageManager] Stage1: Found Enough Ram'
			self.RamChecked = True
			self.SwapCreated = True
Exemple #11
0
	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