diff --git a/pym/cl_utils.py b/pym/cl_utils.py index 483eb9f..059010d 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -617,6 +617,22 @@ def isMount(path): map(lambda x: [x[0], x[1]], map(lambda x: x.split(" "), open(mtabFile)))),[""]))[0] +def childMounts(path): + """Get all mount points which contain path""" + if path != "none": + absPath = os.path.abspath(path) + else: + absPath = path + mtabFile = '/etc/mtab' + if not os.access(mtabFile,os.R_OK): + return "" + return reduce(lambda x,y: x + [y], + filter(lambda x: absPath in x[0] or absPath in x[1], + map(lambda x: [x[0], x[1]], + map(lambda x: x.split(" "), + open(mtabFile)))), + []) + def pathJoin(*paths): """Складывает пути, в отличии от os.path.join, складывает абсолютные пути""" if len(paths)==1: