summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2018-11-23 13:40:59 +0000
committerintrigeri <intrigeri@boum.org>2018-11-23 13:40:59 +0000
commit31cda63e195d95b4e785b80af6c8421c25b5553f (patch)
treece189916dd05e93e884a3e03d176ab7b97402236
parenteb4a6a57b5d0f0defc9c419b6421f6b061f1ca67 (diff)
Use mkdosfs ourselves to pass it the --invariant option (refs: #15985).wip/feature/15292-usb-image-mkdosfs
-rwxr-xr-xauto/scripts/create-usb-image-from-iso50
1 files changed, 32 insertions, 18 deletions
diff --git a/auto/scripts/create-usb-image-from-iso b/auto/scripts/create-usb-image-from-iso
index 7831b38..2862e08 100755
--- a/auto/scripts/create-usb-image-from-iso
+++ b/auto/scripts/create-usb-image-from-iso
@@ -202,12 +202,19 @@ class ImageCreator(object):
def format_partition(self):
logger.info("Formatting partition")
- options = GLib.Variant(
- 'a{sv}',
- {
- 'label': GLib.Variant('s', FILESYSTEM_LABEL),
- 'update-partition-type': GLib.Variant('s', 'FALSE')
- }
+ execute([
+ 'mkfs.vfat',
+ # Use constants for normally randomly generated or time-based data
+ # such as volume ID and creation time
+ '--invariant',
+ # Fill the whole 11 chars to avoid uninitialized memory
+ # XXX: is this necessary?
+ # '-n', 'Tails123456',
+ # XXX: should not be necessary thanks to --invariant
+ # '-i', "{:x}".format(int(os.environ['SOURCE_DATE_EPOCH'])),
+ self.partition.props.block.props.device,
+ ],
+ as_root=True
)
self.partition.props.block.call_format_sync(
@@ -219,18 +226,25 @@ class ImageCreator(object):
@contextmanager
def mount_partition(self):
logger.info("Mounting partition")
- try:
- self.mountpoint = self.partition.props.filesystem.call_mount_sync(
- arg_options=GLib.Variant('a{sv}', None),
- cancellable=None
- )
- except GLib.Error as e:
- if "org.freedesktop.UDisks2.Error.AlreadyMounted" in e.message and \
- self.partition.props.filesystem.props.mount_points:
- self.mountpoint = self.partition.props.filesystem.props.mount_points[0]
- logger.info("Partition is already mounted at {}".format(self.mountpoint))
- else:
- raise
+
+ start_time = time.perf_counter()
+ while time.perf_counter() - start_time < WAIT_FOR_PARTITION_TIMEOUT:
+ try:
+ self.mountpoint = self.partition.props.filesystem.call_mount_sync(
+ arg_options=GLib.Variant('a{sv}', None),
+ cancellable=None
+ )
+ except AttributeError as e:
+ time.sleep(0.1)
+ continue
+ except GLib.Error as e:
+ if "org.freedesktop.UDisks2.Error.AlreadyMounted" in e.message and \
+ self.partition.props.filesystem.props.mount_points:
+ self.mountpoint = self.partition.props.filesystem.props.mount_points[0]
+ logger.info("Partition is already mounted at {}".format(self.mountpoint))
+ break
+ else:
+ raise
try:
yield