Merge branch 'master' of calculate.ru:/calculate-lib

develop
Самоукин Алексей 14 years ago
commit 0240ec5b1c

@ -247,13 +247,17 @@ class fillVars(varsShare):
slpRootDev = rootDev.split("/dev/")
if len(slpRootDev) == 2:
rDev = slpRootDev[1]
devLines = os.listdir("/dev/disk/by-id")
for name in devLines:
pathname = path.join("/dev/disk/by-id", name)
if path.islink(pathname):
if rDev in os.readlink(pathname) and "usb-" in name:
rootType = "usb-hdd"
break
if os.path.exists('/dev/disk/by-id'):
devLines = os.listdir("/dev/disk/by-id")
for name in devLines:
pathname = path.join("/dev/disk/by-id", name)
if path.islink(pathname):
if rDev in os.readlink(pathname) and \
"usb-" in name:
rootType = "usb-hdd"
break
else:
devLines = None
if not devLines:
return ""
if rootType == "ram":

@ -514,6 +514,12 @@ def removeDir(rmDir):
rmtree(rmDir)
return True
def getRunCommands():
"""List run program"""
return map(lambda x:open('/proc/%s/cmdline'%x).read().strip(),
filter(lambda x:x.isdigit(),
os.listdir('/proc')))
def isMount(path):
"""В случае монтирования директории выдает другой примонтированный путь"""
absPath = os.path.abspath(path)

@ -255,7 +255,7 @@ class varsShare:
filesWithType = map(lambda x:(x,ftype(x)), filelist)
return filter(lambda x:descr in x[1],filesWithType)
def getInitrd(self,arch,shortname,chroot,kernel,suffix=""):
def getInitrd(self,arch,shortname,chroot,kernel,suffix="",notsuffix=""):
"""Get initrd for kernel"""
reInitrdVer = re.compile("(initrd|initramfs)-(.+?)(-install)?$",re.S)
def initrd_version_by_name(filename):
@ -277,8 +277,9 @@ class varsShare:
initramfsFiles = self.getFilesByType(bootdir,"ASCII cpio archive")
initramfsWithVer = \
filter(lambda x: (kernelVersion in x[1] or
origKernelVer in x[1]) and \
x[0].endswith(suffix),
origKernelVer in x[1]) and \
x[0].endswith(suffix) and \
(not notsuffix or not x[0].endswith(notsuffix)),
map(lambda x:(x[0],initrd_version_by_name(x[0])),
initramfsFiles))
if initramfsWithVer:

Loading…
Cancel
Save