Page 1 of 1

Screenlets/ Sysmonitor Screenlet

Posted: Thu Jul 30, 2009 9:24 pm
by mmesantos1
Hello,
I am running Linux Mint 7 x64 and ran sysmonitor screenlet and noticed instead of showing Ubuntu 9.04 it displayed Debian 5.0. I was wondering if something changed as far as what distro Linux Mint 7 x64 is based off of?

Re: Screenlets/ Sysmonitor Screenlet

Posted: Thu Jul 30, 2009 9:30 pm
by richyrich
Must be a bug somewhere. . as I have Mint 7 kde, and the SysMon Plasma widget tells me the same thing ???

Image

Re: Screenlets/ Sysmonitor Screenlet

Posted: Thu Jul 30, 2009 9:33 pm
by mmesantos1
richyrich wrote:Must be a bug somewhere. . as I have Mint 7 kde, and the SysMon Plasma widget tells me the same thing ???

Image
You think a bug?

Re: Screenlets/ Sysmonitor Screenlet

Posted: Thu Jul 30, 2009 9:44 pm
by richyrich
Bug might be too harsh . . . but whatever the SysMonitor app looks for, is getting the wrong info.

I wonder . . I upgraded my kernel to 2.6.30 . . . wonder if that has anything to do with it . . I'll turn on my Gloria Main 32bit and check it out . . will post back.

Richy

Re: Screenlets/ Sysmonitor Screenlet

Posted: Thu Jul 30, 2009 9:45 pm
by mmesantos1
richyrich wrote:Bug might be too harsh . . . but whatever the SysMonitor app looks for, is getting the wrong info.

I see, Thanks for the info richyrich. :)

Re: Screenlets/ Sysmonitor Screenlet

Posted: Thu Jul 30, 2009 9:50 pm
by richyrich
Checked Gloria Main 32, and it says Debian 5.0 too . . . . ?

Re: Screenlets/ Sysmonitor Screenlet

Posted: Thu Jul 30, 2009 10:25 pm
by mmesantos1
richyrich wrote:Checked Gloria Main 32, and it says Debian 5.0 too . . . . ?

Hmm, I wonder if someone could shed more light on this? :?:

Re: Screenlets/ Sysmonitor Screenlet

Posted: Wed Sep 23, 2009 5:23 pm
by pneumapilot
It seems that the code for the sensor object (which is a part of the screenlets object) is searching for a certain text file in the /etc/ folder. Many distros have a file called "X-release" where X is the name of the distro, like fedora-release, for example. In Ubuntu and Linux Mint, this file is lsb-release. Apparently, the sysmontor screenlet is either not set up to look for something beginning with 'lsb' or it is not set up to properly interpret the contents of that file. So, instead, it finds the file called 'Debian' in /etc/ and reads its contents, which is simply "5.0".

This is what I have been able to gather today anyway. I'm still looking for a way to solve the problem. If I could find where the screenlets.sensor object is stored locally, I might could tweak it to read the 'lsb-release' file.

Re: Screenlets/ Sysmonitor Screenlet

Posted: Wed Sep 23, 2009 5:36 pm
by vrkalak
I recently upgraded my Linux kernel to 2.6.31-10 generic . . . and it says Ubuntu 9.10
Even my Conky says that. Actually the Conky says: Ubuntu 9.10 (development)

Weird . . . ?? :?

Re: Screenlets/ Sysmonitor Screenlet

Posted: Wed Sep 23, 2009 5:46 pm
by DrHu
mmesantos1 wrote:I am running Linux Mint 7 x64 and ran sysmonitor screenlet and noticed instead of showing Ubuntu 9.04 it displayed Debian 5.0. I was wondering if something changed as far as what distro Linux Mint 7 x64 is based off of?
...noticed instead of showing Ubuntu 9.04 it displayed Debian 5.0...
OK, it shows the wrong parent name for a Ubuntu based release (Ubuntu 9.04 (jaunty) or Linux mint 7(gloria)), so what!..

It, if it can even be called a bug; it is nothing to worry about, nor waste any development resources correcting: the name for the applet (or screenlet if you will).

Re: Screenlets/ Sysmonitor Screenlet

Posted: Wed Sep 23, 2009 5:56 pm
by pneumapilot
Aha! Here is the code in /usr/share/pyshared/screenlets/sensors.py that is the culprit:

Code: Select all

def sys_get_distrib_name():
	try:
		if os.path.exists('/etc/lsb-release') and str(commands.getoutput('cat /etc/lsb-release')).lower().find('ubuntu') != -1:
			return str(commands.getoutput('cat /etc/issue')).replace('\\n','').replace('\l','').replace('\r','').strip()

		elif os.path.exists('/etc/lsb-release'):
			return 'Debian ' + str(commands.getoutput('cat /etc/debian_version'))
		elif os.path.exists('/etc/mandriva-release'):
			return 'Mandriva ' + str(commands.getoutput("cat /etc/mandriva-release | sed -e 's/[A-Za-z ]* release //'"))
		elif os.path.exists('/etc/fedora-release'):
			return 'Fedora ' + str(commands.getoutput("cat /etc/fedora-release | sed -e 's/[A-Za-z ]* release //'"))
		elif os.path.exists('/etc/SuSE-release'):

			if str(commands.getoutput('cat /etc/SuSE-release')).lower().find('openSUSE') != -1:
				return 'openSUSE ' + str(commands.getoutput("""cat /etc/SuSE-release | grep "VERSION" | sed -e 's/VERSION = //'"""))
			else:
				return 'SUSE ' + str(commands.getoutput("""cat /etc/SuSE-release | grep "VERSION" | sed -e 's/VERSION = //'"""))
		elif os.path.exists('/etc/gentoo-release'):
			return 'Gentoo ' + str(commands.getoutput("cat /etc/gentoo-release | sed -e 's/[A-Za-z ]* release //'"))
		elif os.path.exists('/etc/slackware-version'):
			return 'Slackware ' + str(commands.getoutput("cat /etc/slackware-version | sed -e 's/Slackware //'"))
		elif os.path.exists('/etc/arch-release'):
			return 'Arch Linux'
		elif os.path.exists('/etc/redhat-release'):
			return 'Redhat ' + str(commands.getoutput("cat /etc/redhat-release | sed -e 's/[A-Za-z ]* release //'"))
		else:
			f = open("/etc/issue", "r")
			tmp = f.readlines(100)
			f.close()
			return tmp[0].replace('\\n','').replace('\l','').replace('\r','').strip()
	except:
		print _("Error getting distro name")
	return 'Error'
You can see how a distro that uses the lsb-release file will either return 'Ubuntu' or 'Debian', there is no accounting for Mint. Now, I can change this on my machine, but it really needs to be something that is submitted to whoever manages the screenlets code.

Here's how I would change it:

Add this line immediately after the check for ubuntu

Code: Select all

elif os.path.exists('/etc/lsb-release') and str(commands.getoutput('cat /etc/lsb-release')).lower().find('linuxmint') != -1:
			return str(commands.getoutput('cat /etc/issue')).replace('- Main Edition','').replace('\\n','').replace('\l','').replace('\r','').strip()
I had to also remove the text "- Main Edition" because it made the name of the distro too long to be properly displayed. See the attachment for the results on my system.
Screenshot.jpg

Re: Screenlets/ Sysmonitor Screenlet

Posted: Wed Sep 23, 2009 7:40 pm
by optimize me
I don't think it's the lsb_release info. Here's a screen shot of my conky proudly displaying Mint 7 Gloria and the line that fetches the info:

Code: Select all

${pre_exec lsb_release -d | cut -c14-32}
Screenshot.png
And yet, you've done what you've done and it worked.

I am not knowing.

Re: Screenlets/ Sysmonitor Screenlet

Posted: Wed Sep 23, 2009 10:07 pm
by pneumapilot
But it's not the exact same thing as conky, right?

Re: Screenlets/ Sysmonitor Screenlet

Posted: Thu Sep 24, 2009 4:25 am
by optimize me
True enough.

I don't know - it was late and I was having trouble sleeping when I wrote that. It seems to make more sense to me now.

So, OK - carry on.