Added hr_video, hr_x11_video_drv template variables

develop
Самоукин Алексей 14 years ago
parent 2ce48cbbd6
commit 9c360da02b

@ -733,3 +733,63 @@ class fillVars(glob_attr):
return mapNameSystem[shortName]
else:
return ""
def get_hr_x11_video_drv(self):
"""Get video driver used by xorg"""
xorg_modules_dir = '/usr/lib/xorg/modules/drivers'
xorg_conf = '/etc/X11/xorg.conf'
# Try analize Xorg.{DISPLAY}.log
display = os.environ.get('DISPLAY')
if display and os.path.exists(xorg_modules_dir):
list_avialable_drivers = os.listdir(xorg_modules_dir)
if list_avialable_drivers:
reDriver = re.compile('|'.join(list_avialable_drivers))
display_number = re.search(r':(\d+)\..*', display)
if display_number:
xorg_log_file = '/var/log/Xorg.%s.log' % \
display_number.group(1)
if os.path.exists(xorg_log_file):
matchStrs = [i for i in open(xorg_log_file)
if "drv" in i and reDriver.search(i)]
if matchStrs:
resDriver = re.search(r'([^/]+)_drv.so',
matchStrs[-1])
if resDriver:
return resDriver.group(1)
# analize /etc/X11/xorg.conf
if os.path.exists(xorg_conf):
matchSect = re.search(r'Section "Device".*?EndSection',
open('/etc/X11/xorg.conf').read(),re.S)
if matchSect:
resDriver = re.search(r'Driver\s*"([^"]+)"',
matchSect.group(0),re.S)
if resDriver:
return resDriver.group(1)
return "vesa"
def get_hr_video(self):
"""Производитель видеокарты"""
lines=self._runos("lspci")
if not lines:
return ""
reVGA = re.compile("vga",re.I)
foundVGA = False
for line in lines:
if reVGA.search(line):
foundVGA = True
break
if not foundVGA:
return "vesa"
if "nVidia" in line or "GeForce" in line:
return "nvidia"
elif "ATI" in line:
return "ati"
elif "Intel" in line:
return "intel"
elif "VIA" in line:
return "via"
elif "VMware" in line:
return "vmware"
else:
return "vesa"

@ -126,16 +126,16 @@ class Data:
os_linux_ver = {}
# Логин пользователя
ur_login = {'mode':"r"}
ur_login = {}
# Название группы пользователя
ur_group = {'mode':"r", 'official':True}
ur_group = {'official':True}
#Полное имя пользователя
ur_fullname = {'mode':"r", 'official':True}
ur_fullname = {'official':True}
# Домашняя директория пользователя
ur_home_path = {'mode':"r", 'official':True}
ur_home_path = {'official':True}
# Путь к директории относительно которой происходит наложение профилей на
#файлы системы (песочница)
@ -154,10 +154,10 @@ class Data:
cl_pass_state = {}
# Jabber ID пользователя
ur_jid = {'mode':"r", 'official':True}
ur_jid = {'official':True}
# Почтовый адрес пользователя
ur_mail = {'mode':"r", 'official':True}
ur_mail = {'official':True}
# Переменные пакета calculate-client для calculate-desktop
# ip или имя домена (под управлением calculate-server)
@ -169,4 +169,10 @@ class Data:
# совпадает с значением этой переменной
# (имя_пакета == значение cl_belong_pkg)
cl_belong_pkg = {'mode':'r', 'official':True}
# Название производителя видеокарты
hr_video = {'official':True}
# Video driver used by xorg
hr_x11_video_drv = {'official':True}

Loading…
Cancel
Save