From 118b9a721a5d67c6b0160589244fe20fd9f37209 Mon Sep 17 00:00:00 2001 From: asamoukin Date: Tue, 26 May 2009 08:06:48 +0000 Subject: [PATCH] git-svn-id: http://svn.calculate.ru/calculate2/calculate-lib/trunk@1515 c91db197-33c1-4113-bf15-f8a5c547ca64 --- pym/cl_fill.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/pym/cl_fill.py b/pym/cl_fill.py index 08bd994..4fa3ea5 100644 --- a/pym/cl_fill.py +++ b/pym/cl_fill.py @@ -48,7 +48,11 @@ class fillVars(object, cl_base.glob_attr): x.split("=")[1].strip(), data)) if shortNameList: return shortNameList[0] - return "CLD" + gentooFile = "/etc/gentoo-release" + shortName = "Linux" + if os.path.exists(gentooFile): + shortName = "Gentoo" + return shortName def get_os_linux_name(self): """полное название системы""" @@ -56,13 +60,14 @@ class fillVars(object, cl_base.glob_attr): if linuxShortName: dictLinuxName = {"CLD":"Calculate Linux Desktop", "CLDX":"Calculate Linux Desktop", - "CDS":"Calculate Directory Server"} + "CDS":"Calculate Directory Server", + "Gentoo":"Gentoo"} if linuxShortName in dictLinuxName.keys(): return dictLinuxName[linuxShortName] else: - return "" + return "Linux" else: - return "" + return "Linux" def get_os_linux_subname(self): """постфикс к названию системы""" @@ -90,7 +95,19 @@ class fillVars(object, cl_base.glob_attr): x.split("=")[1].strip(), data)) if shortNameList: return shortNameList[0] - return "" + gentooFile = "/etc/gentoo-release" + systemVersion = "" + flagGentoo = False + if os.path.exists(gentooFile): + gentooLink = "/etc/make.profile" + if os.path.islink(gentooLink): + systemVersion = os.readlink(gentooLink).rpartition("/")[2] + flagGentoo = True + if not flagGentoo: + kernelVersion=self._runos("%s uname -r"%self.path_env) + if kernelVersion: + systemVersion = kernelVersion.partition("-")[0] + return systemVersion def get_os_net_hostname(self): '''Считать имя компьютера net_host'''