Add condition for grub install.

lvmraid
Mike Hiretsky 13 years ago
parent 50e35f622a
commit ec86249e99

@ -251,6 +251,7 @@ class fillVars(object, glob_attr):
continue
device = props['DEVNAME']
device_hash[device] = {}
device_hash[device]['table'] = props.get('ID_PART_TABLE_TYPE','')
device_hash[device]['map'] = mapnum
if device in usbdevices:
removablePath = '/sys/block/%s/removable'%device
@ -491,6 +492,10 @@ class fillVars(object, glob_attr):
"""Map number for grub"""
return self.getAttributeFromHash('os_device_hash','map')
def get_os_device_table(self):
"""Table on device"""
return self.getAttributeFromHash('os_device_hash','table')
def get_os_install_grub_devicemap_conf(self):
"""Content of device.map file for grub"""
rootType = self.Get('os_install_root_type')

@ -1492,6 +1492,24 @@ class cl_install(color_print, SignalInterrupt):
('os_install_disk_options',new_options),
('os_install_bind_path',new_bind_src),
('os_install_bind_mountpoint',new_bind_dest)))
if not self.clVars.Get('os_grub2_path'):
if not self.checkForLegacyGrub():
return False
return True
def checkForLegacyGrub(self):
"""Check current disk configuration for installation for install
legacy grub"""
bootDiskType = varSelect("os_disk_type",where="os_install_disk_mount",
eq="/boot")
rootDiskType = varSelect("os_disk_type",where="os_install_disk_mount",
eq="/")
bootDiskType = bootDiskType or rootDiskType
if "lvm" in bootDiskType or "raid" in bootDiskType:
self.printERROR(
_("Legacy grub not support boot from raid or lvm without"
" separate /boot partition"))
return False
return True
def setUsers(self,listUsers):
@ -1503,11 +1521,12 @@ class cl_install(color_print, SignalInterrupt):
self.clVars.Set('cl_migrate_user', migrateUsers, force=True)
return True
def setMBR(self, mbrDisk):
"""Set mbr by param or get from variables"""
def setBR(self, mbrDisk):
"""Set boot record on disk by param or get from variables"""
bootDiskGrub = ""
if mbrDisk == "off":
self.clVars.Set('os_install_mbr',"",force=True)
return True
elif mbrDisk:
if filter(lambda x: x == mbrDisk,
self.clVars.Get('os_device_dev')):
@ -1515,6 +1534,13 @@ class cl_install(color_print, SignalInterrupt):
else:
self.printERROR(_("Cann't found disk '%s'")%mbrDisk)
return False
mbr = self.clVars.Get('os_install_mbr')
tableOnBootDisk = self.varSelect('os_device_table',
where="os_device_dev",eq='mbr')
if not tableOnBootDisk:
self.printERROR(_("Disk '%s' without partition table cann't "
"contains boot record")%mbr)
return False
return True
def createListOptions(self):
@ -1561,12 +1587,12 @@ class cl_install(color_print, SignalInterrupt):
return True
def setInstallOptions(self, listDisks, listBinds, listSwaps, listUsers,
mbrDisk):
"""Set install options (set users, disks and mbr"""
brDisk):
"""Set install options (set users, disks and boot record"""
try:
if self.setUsers(listUsers) and \
self.setDisks(listDisks,listBinds,listSwaps) and \
self.setMBR(mbrDisk):
self.setBR(brDisk):
return self.createListOptions()
else:
return False

@ -123,6 +123,9 @@ class Data:
# map number for grub
os_device_map = {}
# table for device
os_device_table = {}
# content of device.map file for grub
os_install_grub_devicemap_conf = {}

Loading…
Cancel
Save