|
|
@ -258,6 +258,14 @@ class fillVars(object, glob_attr):
|
|
|
|
key = blkid_hash[key]
|
|
|
|
key = blkid_hash[key]
|
|
|
|
disk_hash[dev][key] = value[1:-1]
|
|
|
|
disk_hash[dev][key] = value[1:-1]
|
|
|
|
# discard comment and empty string
|
|
|
|
# discard comment and empty string
|
|
|
|
|
|
|
|
devuuid = '/dev/disk/by-uuid'
|
|
|
|
|
|
|
|
mapUuidDev = dict(
|
|
|
|
|
|
|
|
map(lambda x:("UUID=%s"%os.path.basename(x),
|
|
|
|
|
|
|
|
os.path.normpath(os.path.join(devuuid,os.readlink(x)))),
|
|
|
|
|
|
|
|
filter(os.path.islink,
|
|
|
|
|
|
|
|
map(lambda x:os.path.join(devuuid,x),
|
|
|
|
|
|
|
|
os.listdir(devuuid)))))
|
|
|
|
|
|
|
|
mapDevUuid = dict(map(lambda x:(x[1],x[0]),mapUuidDev.items()))
|
|
|
|
mountOptionsList = \
|
|
|
|
mountOptionsList = \
|
|
|
|
filter(lambda x: x.strip() and not x.strip().startswith('#'),
|
|
|
|
filter(lambda x: x.strip() and not x.strip().startswith('#'),
|
|
|
|
open("/etc/fstab").readlines())
|
|
|
|
open("/etc/fstab").readlines())
|
|
|
@ -270,12 +278,12 @@ class fillVars(object, glob_attr):
|
|
|
|
mountOptionsList))
|
|
|
|
mountOptionsList))
|
|
|
|
# get dev which has ntfs filesystem
|
|
|
|
# get dev which has ntfs filesystem
|
|
|
|
mountFormatList = \
|
|
|
|
mountFormatList = \
|
|
|
|
filter(lambda x: x[0] in disk_hash.keys() and \
|
|
|
|
filter(lambda x: mapUuidDev.get(x[0],x[0]) in disk_hash.keys() \
|
|
|
|
x[1] in ("ntfs","ntfs-3g"),
|
|
|
|
and x[1] in ("ntfs","ntfs-3g"),
|
|
|
|
map(lambda y: (y[0],y[2]), mountOptionsList))
|
|
|
|
map(lambda y: (y[0],y[2]), mountOptionsList))
|
|
|
|
# split options and discard rw opt
|
|
|
|
# split options and discard rw opt
|
|
|
|
mountOptionsList = \
|
|
|
|
mountOptionsList = \
|
|
|
|
filter(lambda x: x[0] in disk_hash.keys(),
|
|
|
|
filter(lambda x: mapUuidDev.get(x[0],x[0]) in disk_hash.keys(),
|
|
|
|
map(lambda y: (y[0],filter(lambda z: z!="rw",
|
|
|
|
map(lambda y: (y[0],filter(lambda z: z!="rw",
|
|
|
|
y[3].split(','))),
|
|
|
|
y[3].split(','))),
|
|
|
|
mountOptionsList))
|
|
|
|
mountOptionsList))
|
|
|
@ -283,11 +291,12 @@ class fillVars(object, glob_attr):
|
|
|
|
dictOptionList = dict(mountOptionsList)
|
|
|
|
dictOptionList = dict(mountOptionsList)
|
|
|
|
dictFormatList = dict(mountFormatList)
|
|
|
|
dictFormatList = dict(mountFormatList)
|
|
|
|
for dev in disk_hash.keys():
|
|
|
|
for dev in disk_hash.keys():
|
|
|
|
if dev in dictOptionList:
|
|
|
|
iddev = mapDevUuid.get(dev,dev)
|
|
|
|
disk_hash[dev]['options'] = ",".join(dictOptionList[dev])
|
|
|
|
if iddev in dictOptionList:
|
|
|
|
if dev in dictFormatList and "format" in disk_hash[dev] and \
|
|
|
|
disk_hash[dev]['options'] = ",".join(dictOptionList[iddev])
|
|
|
|
|
|
|
|
if iddev in dictFormatList and "format" in disk_hash[dev] and \
|
|
|
|
disk_hash[dev]['format'] in ("ntfs","ntfs-3g"):
|
|
|
|
disk_hash[dev]['format'] in ("ntfs","ntfs-3g"):
|
|
|
|
disk_hash[dev]['format'] = dictFormatList[dev]
|
|
|
|
disk_hash[dev]['format'] = dictFormatList[iddev]
|
|
|
|
return disk_hash
|
|
|
|
return disk_hash
|
|
|
|
|
|
|
|
|
|
|
|
def separateDevice(self,device):
|
|
|
|
def separateDevice(self,device):
|
|
|
|