diff options
Diffstat (limited to 'abs/core-testing/LinHES-config/mv_install.py')
-rwxr-xr-x | abs/core-testing/LinHES-config/mv_install.py | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py index 87fbaae..9d70a55 100755 --- a/abs/core-testing/LinHES-config/mv_install.py +++ b/abs/core-testing/LinHES-config/mv_install.py @@ -219,16 +219,33 @@ def umount_bind_chroot(): runcmd(cmd) +def blank_table(diskdevice): + logging.debug(" writing new parition table for %s", diskdevice) + logging.debug("parition table before:") + cmd = "fdisk -l %s" %diskdevice + runcmd(cmd) + + cmd = "echo w |fdisk %s" %diskdevice + runcmd(cmd) + + logging.debug("parition table after:") + cmd = "fdisk -l %s" %diskdevice + runcmd(cmd) + def partitions_removeall(diskdevice, label): logging.info("Removing all partitions for %s %s", label, diskdevice) - device = parted.getDevice(diskdevice) - partdisk = parted.Disk(device) - partdisk.deleteAllPartitions() - if data_config.NOOPDEBUG == "FALSE": - partdisk.commit() + try: + device = parted.getDevice(diskdevice) + partdisk = parted.Disk(device) + partdisk.deleteAllPartitions() + if data_config.NOOPDEBUG == "FALSE": + partdisk.commit() + for partition in partdisk.partitions: + print "type: %s" %partition.type + except: + logging.debug(" Error reading parition table, attempting to write a blank one") + blank_table(diskdevice) - for partition in partdisk.partitions: - print "type: %s" %partition.type def create_partitions(diskdevice, size, ptype, startsector): logging.debug("_____Create partitions______") |