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/") slpRootDev = rootDev.split("/dev/")
if len(slpRootDev) == 2: if len(slpRootDev) == 2:
rDev = slpRootDev[1] rDev = slpRootDev[1]
devLines = os.listdir("/dev/disk/by-id") if os.path.exists('/dev/disk/by-id'):
for name in devLines: devLines = os.listdir("/dev/disk/by-id")
pathname = path.join("/dev/disk/by-id", name) for name in devLines:
if path.islink(pathname): pathname = path.join("/dev/disk/by-id", name)
if rDev in os.readlink(pathname) and "usb-" in name: if path.islink(pathname):
rootType = "usb-hdd" if rDev in os.readlink(pathname) and \
break "usb-" in name:
rootType = "usb-hdd"
break
else:
devLines = None
if not devLines: if not devLines:
return "" return ""
if rootType == "ram": if rootType == "ram":

@ -514,6 +514,12 @@ def removeDir(rmDir):
rmtree(rmDir) rmtree(rmDir)
return True 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): def isMount(path):
"""В случае монтирования директории выдает другой примонтированный путь""" """В случае монтирования директории выдает другой примонтированный путь"""
absPath = os.path.abspath(path) absPath = os.path.abspath(path)

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

Loading…
Cancel
Save