Os detect update.

lvmraid
Mike Hiretsky 13 years ago
parent 71ae46b885
commit b129e397bc

@ -130,7 +130,7 @@ class DistributiveRepository:
else:
return {}
def _getfromcontent(self,filename):
def _getfromcontent(self,filename,addFunc=None):
"""Get info from content"""
varsShare = self.varsShare
distr = None
@ -173,6 +173,8 @@ class DistributiveRepository:
d['build'] = os_linux_build[-1]
else:
d['build'] = ""
if addFunc:
d = addFunc(filename,d)
if distr:
distr.close()
return d

@ -27,7 +27,7 @@ from cl_utils import isMount,typeFile,getTupleVersion,pathJoin,isFstabMount,\
getUdevDeviceInfo, getPartitionDevice, getPartitionSize, \
isPkgInstalled, process, checkUtils, readLinesFile, \
FStab, lspci, getInstalledVideo,getDeviceType, \
getPartitionType
getPartitionType, getOsProberHash
from cl_distr import DistributiveRepository,PartitionDistributive
from cl_fill import clLocale
from operator import itemgetter
@ -291,6 +291,8 @@ class fillVars(object, glob_attr):
disk_hash = {}
fstab = FStab('/etc/fstab')
distrRep = DistributiveRepository()
osProberHash = getOsProberHash(getContentFunc=distrRep._getfromcontent)
for disk in new_disks:
props = getUdevDeviceInfo(disk)
if not "DEVNAME" in props:
@ -310,6 +312,7 @@ class fillVars(object, glob_attr):
dev_hash['part'] = getPartitionType(props)
dev_hash['options'] = fstab.getBy(what=fstab.OPTS,eq=devName) or ""
dev_hash['size'] = getPartitionSize(disk)
dev_hash['content'] = osProberHash.get(devName,'')
if devParent in devicesHash and 'ID_PART_ENTRY_NUMBER' in props:
dev_hash['grub'] = "%s,%d"%(devicesHash[devParent]['map'],
int(props['ID_PART_ENTRY_NUMBER'])-1)
@ -470,6 +473,10 @@ class fillVars(object, glob_attr):
"""Partition type"""
return self.getAttributeFromHash('os_disk_hash','type')
def get_os_disk_content(self):
"""Partition content"""
return self.getAttributeFromHash('os_disk_hash','content')
def get_os_disk_name(self):
"""Label of partitions"""
return self.getAttributeFromHash('os_disk_hash','name')

@ -1769,24 +1769,30 @@ class cl_install(color_print, SignalInterrupt):
"""Generate table for all partitions"""
def convertTypeToScheme(diskType):
res = ""
typeDict = {'loop':_("Loop"),
'raid':_("RAID"),
'lvm':_("LVM"),
'partition':_("Partition"),
'disk':_("Disk")}
for i in diskType.split('-'):
res = "%s on %s"%(typeDict.get(i,_('None')),res) if res else \
typeDict.get(i,_('None'))
return res
if "raid-lvm" in diskType:
return _("LVM on RAID")
elif "disk-partition" == diskType:
return _("Partition on disk")
elif "raid-partition" == diskType:
return _("Partition on RAID")
elif "disk" in diskType:
return _("Disk without partitions")
elif "lvm" in diskType:
return _("LVM")
elif "raid" in diskType:
return _("RAID")
else:
return _("Partition")
title = _("Available partitions")
headerList = [_("Size"),_("Device"),_("Label"),_("Directory"),
_("File system"), _("Scheme")]
headerList = [_("Size"),_("Device"),_("Label"),_("Mount point"),
_("File system"), _("Type"),_("OS")]
return title, headerList, zip(self.clVars.Get('os_disk_size'),
self.clVars.Get('os_disk_dev'),
self.clVars.Get('os_disk_name'),
self.clVars.Get('os_disk_mount'),
self.clVars.Get('os_disk_format'),
map(convertTypeToScheme,self.clVars.Get('os_disk_type')))
map(convertTypeToScheme,self.clVars.Get('os_disk_type')),
self.clVars.Get('os_disk_content'))
def generateTableMountData(self):
"""Get data from print table"""

@ -148,7 +148,8 @@ CMD_OPTIONS = [{'shortOption':"d",
'help':_("use passwords for the users accounts \
(from standard input)")
},
{'longOption':"show-partitions",
{'shortOption':'p',
'longOption':"show-partitions",
'help':_("display all partitions")}
]

@ -61,6 +61,9 @@ class Data:
# list mounted points for current operation system
os_disk_mount = {}
# partition content
os_disk_content = {}
# list filesystem for partition devices
os_disk_format = {}

@ -59,7 +59,7 @@ if __name__ == "__main__":
if options.v or options.filter or options.xml:
install.printVars(options)
sys.exit(0)
if options.show_partitions:
if options.p:
install.showPartitions()
sys.exit(0)
# check root

Loading…
Cancel
Save