|
|
|
@ -36,28 +36,18 @@ class fillVars(object, cl_base.glob_attr):
|
|
|
|
|
|
|
|
|
|
def get_os_linux_shortname(self):
|
|
|
|
|
'''Получить переменную короткого названия системы'''
|
|
|
|
|
path = '/etc/issue'
|
|
|
|
|
sp="""Welcome to \\\\n.\\\\O \(([a-zA-Z ]+) ([^\s\)]+)"""
|
|
|
|
|
res=self._runos('%scat %s | grep "Welcome to "'%\
|
|
|
|
|
(self.path_env, path))
|
|
|
|
|
dist_ver = {'CLDX':"Calculate Linux Desktop Lite",
|
|
|
|
|
'CLD':"Calculate Linux Desktop",
|
|
|
|
|
'CDS':"Calculate Directory Server"}
|
|
|
|
|
if res:
|
|
|
|
|
if re.search(sp,res):
|
|
|
|
|
vals=re.search(sp,res).groups()
|
|
|
|
|
issuename=vals[0]
|
|
|
|
|
for i in dist_ver.keys():
|
|
|
|
|
if dist_ver[i]==issuename:
|
|
|
|
|
return i
|
|
|
|
|
spl=issuename.split(" ")
|
|
|
|
|
nname=""
|
|
|
|
|
if len(spl)>1:
|
|
|
|
|
for i in spl:
|
|
|
|
|
nname+=i[1]
|
|
|
|
|
return nname
|
|
|
|
|
else:
|
|
|
|
|
return issuename
|
|
|
|
|
path = '/etc/calculate/calculate.ini'
|
|
|
|
|
if os.path.exists(path):
|
|
|
|
|
FD = open(path)
|
|
|
|
|
data = FD.readlines()
|
|
|
|
|
FD.close()
|
|
|
|
|
shortName = filter(lambda y:y,
|
|
|
|
|
map(lambda x:\
|
|
|
|
|
len(x.split("="))==2 and\
|
|
|
|
|
x.split("=")[0]=="calculate" and\
|
|
|
|
|
x.split("=")[1].strip(), data))[0]
|
|
|
|
|
if shortName:
|
|
|
|
|
return shortName
|
|
|
|
|
return "CLD"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|