|
|
|
@ -22,7 +22,7 @@ import cl_overriding
|
|
|
|
|
from cl_datavars import glob_attr
|
|
|
|
|
from os import path
|
|
|
|
|
from os import readlink,listdir,access,R_OK
|
|
|
|
|
from cl_utils import isMount,typeFile,getTupleVersion,pathJoin
|
|
|
|
|
from cl_utils import isMount,typeFile,getTupleVersion,pathJoin,isFstabMount
|
|
|
|
|
from cl_distr import DistributiveRepository
|
|
|
|
|
from cl_fill import clLocale
|
|
|
|
|
from operator import itemgetter
|
|
|
|
@ -297,33 +297,11 @@ class fillVars(object, glob_attr):
|
|
|
|
|
"""List mount options for partition devices of installed os"""
|
|
|
|
|
return self.Get('os_disk_options')
|
|
|
|
|
|
|
|
|
|
def isFstabMount(self,pathname):
|
|
|
|
|
"""Get mount point or device from fstab"""
|
|
|
|
|
if pathname == "swap":
|
|
|
|
|
absPath = "swap"
|
|
|
|
|
else:
|
|
|
|
|
absPath = path.abspath(pathname)
|
|
|
|
|
# convert fstab to
|
|
|
|
|
# [['/dev/sda3', '/', '', 'reiserfs', 'noatime', '', '', '0', '2\n'],
|
|
|
|
|
# ['/dev/sda5', '/var/calculate', 'reiserfs', 'noatime', '0', '0\n']]
|
|
|
|
|
listFstab = filter(lambda x: len(x) >= 4,
|
|
|
|
|
map(lambda x: filter(lambda x: x,
|
|
|
|
|
x.replace('\t',' ').split(' ')),
|
|
|
|
|
filter(lambda x: not x.startswith('#') and x.strip(),
|
|
|
|
|
open("/etc/fstab"))))
|
|
|
|
|
# get mount point or device or dir
|
|
|
|
|
return filter(lambda x: x!=absPath,
|
|
|
|
|
reduce(lambda x,y: y,
|
|
|
|
|
filter(lambda x: absPath in x and x[1] != "none",
|
|
|
|
|
map(lambda x: [x[0],
|
|
|
|
|
x[1] if x[2] != "swap" else "swap"],
|
|
|
|
|
listFstab)),[""]))[0]
|
|
|
|
|
|
|
|
|
|
def get_os_install_disk_mount(self):
|
|
|
|
|
"""List mounted points for installed system"""
|
|
|
|
|
rootdev = self.Get('os_install_root_dev')
|
|
|
|
|
disk_hash = self.Get('os_disk_hash')
|
|
|
|
|
fstabHasSwap = self.isFstabMount('swap')
|
|
|
|
|
fstabHasSwap = isFstabMount('swap')
|
|
|
|
|
def getMountPoint(disk):
|
|
|
|
|
if disk == rootdev:
|
|
|
|
|
return "/"
|
|
|
|
@ -331,7 +309,7 @@ class fillVars(object, glob_attr):
|
|
|
|
|
"swap" in disk_hash[disk]['format']:
|
|
|
|
|
return "swap"
|
|
|
|
|
else:
|
|
|
|
|
mount_point = self.isFstabMount(disk)
|
|
|
|
|
mount_point = isFstabMount(disk)
|
|
|
|
|
if mount_point in self.nonTransferedDirs:
|
|
|
|
|
return ""
|
|
|
|
|
else:
|
|
|
|
@ -342,7 +320,7 @@ class fillVars(object, glob_attr):
|
|
|
|
|
def get_os_disk_mount(self):
|
|
|
|
|
"""List mounted points for current operation system"""
|
|
|
|
|
disk_hash = self.Get('os_disk_hash')
|
|
|
|
|
return map(lambda x: self.isFstabMount(x) or "",
|
|
|
|
|
return map(lambda x: isFstabMount(x) or "",
|
|
|
|
|
sorted(self.Get('os_disk_hash').keys()))
|
|
|
|
|
|
|
|
|
|
def get_os_disk_format(self):
|
|
|
|
|