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:42:39 +0000
commit48a9700a11713f497d684f97ef90a928e76e908a (patch)
tree25009431e8009eee3d9fe4e059721a7402429d5a
parenteb4a6a57b5d0f0defc9c419b6421f6b061f1ca67 (diff)
Use mformat (refs: #15985).wip/feature/15292-usb-image-mformat
-rwxr-xr-xauto/scripts/create-usb-image-from-iso62
1 files changed, 39 insertions, 23 deletions
diff --git a/auto/scripts/create-usb-image-from-iso b/auto/scripts/create-usb-image-from-iso
index 7831b38..1b267aa 100755
--- a/auto/scripts/create-usb-image-from-iso
+++ b/auto/scripts/create-usb-image-from-iso
@@ -202,35 +202,51 @@ 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')
- }
- )
- self.partition.props.block.call_format_sync(
- arg_type='vfat',
- arg_options=options,
- cancellable=None
+ execute([
+ 'faketime', '1980-01-01 00:00:00',
+ 'mformat',
+ # FAT32
+ '-F',
+ # serial number
+ '-N', "{:x}".format(int(os.environ['SOURCE_DATE_EPOCH'])),
+ # label
+ '-v', 'Tails123456',
+ # tracks
+ '-t', '50484', # 3180544 / 63
+ # heads
+ '-h', '255',
+ # sectors/track
+ '-s', '63',
+ # device
+ '-i', self.partition.props.block.props.device,
+ '::'
+ ],
+ as_root=True
)
@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