2013-09-18 00:46:58 +02:00
|
|
|
from common.tools import log_check_call
|
|
|
|
from base import BasePartition
|
|
|
|
|
|
|
|
|
2014-01-18 21:23:54 +00:00
|
|
|
class MSDOSPartition(BasePartition):
|
2013-09-18 00:46:58 +02:00
|
|
|
|
2013-10-08 23:12:03 +02:00
|
|
|
def get_start(self):
|
|
|
|
if self.previous is None:
|
|
|
|
return 1 # Post-MBR gap for embedding grub
|
|
|
|
else:
|
|
|
|
return self.previous.get_start() + self.previous.size
|
|
|
|
|
2013-09-22 21:20:09 +02:00
|
|
|
def _before_create(self, e):
|
2013-09-18 00:46:58 +02:00
|
|
|
start = self.get_start()
|
|
|
|
parted_command = ('mkpart primary {start}MiB {end}MiB'
|
|
|
|
.format(start=str(start),
|
|
|
|
end=str(start + self.size)))
|
|
|
|
log_check_call(['/sbin/parted', '--script', '--align', 'none', e.volume.device_path,
|
|
|
|
'--', parted_command])
|