mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
20 lines
763 B
Python
20 lines
763 B
Python
![]() |
from common.tools import log_check_call
|
||
|
from base import BasePartition
|
||
|
|
||
|
|
||
|
class GPTPartition(BasePartition):
|
||
|
|
||
|
def __init__(self, size, filesystem, name, previous, callbacks={}):
|
||
|
self.name = name
|
||
|
super(GPTPartition, self).__init__(size, filesystem, previous, callbacks=callbacks)
|
||
|
|
||
|
def _create(self, e):
|
||
|
start = self.get_start()
|
||
|
# {name} only works for gpt, for msdos that becomes the part-type (primary, extended, logical)
|
||
|
parted_command = ('mkpart primary {start}MiB {end}MiB'
|
||
|
.format(name=self.name,
|
||
|
start=str(start),
|
||
|
end=str(start + self.size)))
|
||
|
log_check_call(['/sbin/parted', '--script', '--align', 'none', e.volume.device_path,
|
||
|
'--', parted_command])
|