diff --git a/pym/cl_fill.py b/pym/cl_fill.py index 0872393..08bd994 100644 --- a/pym/cl_fill.py +++ b/pym/cl_fill.py @@ -50,6 +50,47 @@ class fillVars(object, cl_base.glob_attr): return shortNameList[0] return "CLD" + def get_os_linux_name(self): + """полное название системы""" + linuxShortName = self.Get("os_linux_shortname") + if linuxShortName: + dictLinuxName = {"CLD":"Calculate Linux Desktop", + "CLDX":"Calculate Linux Desktop", + "CDS":"Calculate Directory Server"} + if linuxShortName in dictLinuxName.keys(): + return dictLinuxName[linuxShortName] + else: + return "" + else: + return "" + + def get_os_linux_subname(self): + """постфикс к названию системы""" + linuxShortName = self.Get("os_linux_shortname") + if linuxShortName: + dictLinuxSubName = {"CLD":"KDE", "CLDX":"XFCE"} + if linuxShortName in dictLinuxSubName.keys(): + return dictLinuxSubName[linuxShortName] + else: + return "" + else: + return "" + + def get_os_linux_ver(self): + '''Получить версию системы''' + path = '/etc/calculate/calculate.ini' + if os.path.exists(path): + FD = open(path) + data = FD.readlines() + FD.close() + shortNameList = filter(lambda y:y, + map(lambda x:\ + len(x.split("="))==2 and\ + x.split("=")[0]=="linuxver" and\ + x.split("=")[1].strip(), data)) + if shortNameList: + return shortNameList[0] + return "" def get_os_net_hostname(self): '''Считать имя компьютера net_host''' diff --git a/pym/cl_vars.py b/pym/cl_vars.py index 2334cbc..714ea49 100644 --- a/pym/cl_vars.py +++ b/pym/cl_vars.py @@ -71,4 +71,13 @@ class Data: os_root_dev = {} # тип носителя (ram, hdd, usb-hdd, livecd) - os_root_type = {} \ No newline at end of file + os_root_type = {} + + # полное название системы + os_linux_name = {} + + # постфикс к названию системы + os_linux_subname = {} + + # версия системы + os_linux_ver = {}