summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/imager/direct.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/plugins/imager/direct.py')
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 9b619e41c1..a1d152659b 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -530,6 +530,16 @@ class PartitionedImage():
530 exec_native_cmd("parted -s %s mklabel %s" % (device, ptable_format), 530 exec_native_cmd("parted -s %s mklabel %s" % (device, ptable_format),
531 self.native_sysroot) 531 self.native_sysroot)
532 532
533 def _write_disk_guid(self):
534 if self.ptable_format in ('gpt', 'gpt-hybrid'):
535 if os.getenv('SOURCE_DATE_EPOCH'):
536 self.disk_guid = uuid.UUID(int=int(os.getenv('SOURCE_DATE_EPOCH')))
537 else:
538 self.disk_guid = uuid.uuid4()
539
540 logger.debug("Set disk guid %s", self.disk_guid)
541 sfdisk_cmd = "sfdisk --disk-id %s %s" % (self.path, self.disk_guid)
542 exec_native_cmd(sfdisk_cmd, self.native_sysroot)
533 543
534 def create(self): 544 def create(self):
535 self._make_disk(self.path, 545 self._make_disk(self.path,
@@ -537,6 +547,7 @@ class PartitionedImage():
537 self.min_size) 547 self.min_size)
538 548
539 self._write_identifier(self.path, self.identifier) 549 self._write_identifier(self.path, self.identifier)
550 self._write_disk_guid()
540 551
541 if self.ptable_format == "gpt-hybrid": 552 if self.ptable_format == "gpt-hybrid":
542 mbr_path = self.path + ".mbr" 553 mbr_path = self.path + ".mbr"