diff --git a/pym/cl_distr.py b/pym/cl_distr.py index 97f110e..7e73a2e 100644 --- a/pym/cl_distr.py +++ b/pym/cl_distr.py @@ -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 diff --git a/pym/cl_fill_install.py b/pym/cl_fill_install.py index 30e0ebd..91e0baa 100644 --- a/pym/cl_fill_install.py +++ b/pym/cl_fill_install.py @@ -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') diff --git a/pym/cl_install.py b/pym/cl_install.py index 02c1cd7..93d60ee 100644 --- a/pym/cl_install.py +++ b/pym/cl_install.py @@ -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""" diff --git a/pym/cl_install_cmd.py b/pym/cl_install_cmd.py index cbf3e6b..3c81ec5 100644 --- a/pym/cl_install_cmd.py +++ b/pym/cl_install_cmd.py @@ -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")} ] diff --git a/pym/cl_vars_install.py b/pym/cl_vars_install.py index 89cd769..fdcb803 100644 --- a/pym/cl_vars_install.py +++ b/pym/cl_vars_install.py @@ -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 = {} diff --git a/scripts/cl-install b/scripts/cl-install index 12d527f..92e9d76 100644 --- a/scripts/cl-install +++ b/scripts/cl-install @@ -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