|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import os
|
|
|
|
|
import types
|
|
|
|
|
import cl_utils
|
|
|
|
|
import cl_base
|
|
|
|
|
|
|
|
|
@ -131,4 +132,46 @@ class fillVars(object, cl_base.glob_attr):
|
|
|
|
|
def get_os_arch_machine(self):
|
|
|
|
|
"""архитектура процессора"""
|
|
|
|
|
march = self._runos("""%s uname -m"""%self.path_env)
|
|
|
|
|
return march
|
|
|
|
|
return march
|
|
|
|
|
|
|
|
|
|
def get_os_root_dev(self):
|
|
|
|
|
"""корневой раздел файловой системы"""
|
|
|
|
|
for record in open('/proc/cmdline','rb').readlines():
|
|
|
|
|
re_res=re.search('^root=(\/dev\/[a-z]+[0-9]).*',record.strip())
|
|
|
|
|
if re_res:
|
|
|
|
|
return re_res.group(1)
|
|
|
|
|
else:
|
|
|
|
|
mountLunes = self._runos("""%s mount"""%self.path_env)
|
|
|
|
|
if type(mountLunes) == types.ListType:
|
|
|
|
|
root_dev = mountLunes[0].split("on / type")[0].strip()
|
|
|
|
|
if root_dev:
|
|
|
|
|
return root_dev
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get_os_root_type(self):
|
|
|
|
|
"""тип носителя (ram, hdd, livecd)"""
|
|
|
|
|
mountLunes = self._runos("""%s mount"""%self.path_env)
|
|
|
|
|
rootType = "hdd"
|
|
|
|
|
if type(mountLunes) == types.ListType:
|
|
|
|
|
for line in mountLunes:
|
|
|
|
|
if "/dev/loop0 on / type" in line:
|
|
|
|
|
rootType = "ram"
|
|
|
|
|
break
|
|
|
|
|
if rootType == "ram" and os.path.exists("/mnt/livecd"):
|
|
|
|
|
rootType = "livecd"
|
|
|
|
|
return rootType
|
|
|
|
|
rootDev = self.Get("os_root_dev")
|
|
|
|
|
if rootType != "ram" and rootDev:
|
|
|
|
|
slpRootDev = rootDev.split("/dev/")
|
|
|
|
|
if len(slpRootDev) == 2:
|
|
|
|
|
rDev = slpRootDev[1]
|
|
|
|
|
devLines = self._runos("%s LANG=C ls -la /dev/disk/by-id/"\
|
|
|
|
|
%self.path_env)
|
|
|
|
|
if type(devLines) == types.ListType:
|
|
|
|
|
for line in devLines:
|
|
|
|
|
if rDev in line and "usb-" in line:
|
|
|
|
|
rootType = "usb-hdd"
|
|
|
|
|
break
|
|
|
|
|
return rootType
|
|
|
|
|
else:
|
|
|
|
|
return ""
|