Merge lp:~xnox/usb-creator/wipeout into lp:usb-creator

Proposed by Dimitri John Ledkov
Status: Rejected
Rejected by: Dimitri John Ledkov
Proposed branch: lp:~xnox/usb-creator/wipeout
Merge into: lp:usb-creator
Diff against target: 57 lines (+20/-13)
2 files modified
bin/usb-creator-helper (+20/-9)
usbcreator/backends/udisks/backend.py (+0/-4)
To merge this branch: bzr merge lp:~xnox/usb-creator/wipeout
Reviewer Review Type Date Requested Status
Evan Pending
usb-creator hackers Pending
Review via email: mp+106592@code.launchpad.net

This proposal supersedes a proposal from 2012-05-21.

Description of the change

Merge a (modified) patch from bug #484252. This changes the format button to erase selected partition, instead of wiping the whole drive (potential data loss).

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote : Posted in a previous version of this proposal

* tested formatting with multi partition usb-stick
* tested booting created bootable usb using multi partitioned usb-stick

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/usb-creator-helper'
--- bin/usb-creator-helper 2012-05-04 10:43:38 +0000
+++ bin/usb-creator-helper 2012-05-21 08:57:17 +0000
@@ -214,18 +214,29 @@
214 '/org/freedesktop/UDisks')214 '/org/freedesktop/UDisks')
215 device = udisks.FindDeviceByDeviceFile(device, dbus_interface=DISKS_IFACE)215 device = udisks.FindDeviceByDeviceFile(device, dbus_interface=DISKS_IFACE)
216 dev = bus.get_object(DISKS_IFACE, device)216 dev = bus.get_object(DISKS_IFACE, device)
217 # Use the disk if asked to format a partition.217
218 if dev.Get(device, 'device-is-partition', dbus_interface=PROPS_IFACE):
219 device = dev.Get(device, 'partition-slave', dbus_interface=PROPS_IFACE)
220 dev = bus.get_object(DISKS_IFACE, device)
221 dev_file = dev.Get(device, 'device-file', dbus_interface=PROPS_IFACE)
222 # TODO LOCK218 # TODO LOCK
223 unmount_all(device)219 unmount_all(device)
224 size = dev.Get(device, 'device-size', dbus_interface=PROPS_IFACE)220 # Do NOT use the disk if asked to format a partition.
225 dev.PartitionTableCreate('mbr', [], dbus_interface=DEVICE_IFACE, timeout=600)221 # We still need to obtain the disk device name to zero out the MBR
226 dev.PartitionCreate(0, size, '0x0c', '', ['boot'], [], 'vfat', [],222 if dev.Get(device, 'device-is-partition', dbus_interface=PROPS_IFACE):
227 dbus_interface=DEVICE_IFACE)223 # Create the partition
224 dev.PartitionModify('0x0c', '', ['boot'], dbus_interface=DEVICE_IFACE)
225 dev.FilesystemCreate('vfat', [], dbus_interface=DEVICE_IFACE)
226
227 # Get the master device
228 device = dev.Get(device, 'partition-slave', dbus_interface=PROPS_IFACE)
229 dev = bus.get_object(DISKS_IFACE, device)
230 else:
231 # Create a new partition table and a FAT partition.
232 size = dev.Get(device, 'device-size', dbus_interface=PROPS_IFACE)
233 dev.PartitionTableCreate('mbr', [], dbus_interface=DEVICE_IFACE,
234 timeout=600)
235 dev.PartitionCreate(0, size, '0x0c', '', ['boot'], [], 'vfat', [],
236 dbus_interface=DEVICE_IFACE)
237
228 # Zero out the MBR. Will require fancy privileges.238 # Zero out the MBR. Will require fancy privileges.
239 dev_file = dev.Get(device, 'device-file', dbus_interface=PROPS_IFACE)
229 popen(['dd', 'if=/dev/zero', 'of=%s' % dev_file, 'bs=446', 'count=1'])240 popen(['dd', 'if=/dev/zero', 'of=%s' % dev_file, 'bs=446', 'count=1'])
230 # TODO UNLOCK241 # TODO UNLOCK
231242
232243
=== modified file 'usbcreator/backends/udisks/backend.py'
--- usbcreator/backends/udisks/backend.py 2012-05-04 10:33:25 +0000
+++ usbcreator/backends/udisks/backend.py 2012-05-21 08:57:17 +0000
@@ -284,10 +284,6 @@
284 try:284 try:
285 dk = self.bus.get_object(DISKS_IFACE, device)285 dk = self.bus.get_object(DISKS_IFACE, device)
286 dev = dk.Get(device, 'device-file', dbus_interface=PROPS_IFACE)286 dev = dk.Get(device, 'device-file', dbus_interface=PROPS_IFACE)
287 if dk.Get(dev, 'device-is-partition', dbus_interface=PROPS_IFACE):
288 dev = dk.Get(dev, 'partition-slave', dbus_interface=PROPS_IFACE)
289 dk = self.bus.get_object(DISKS_IFACE, dev)
290 dev = dk.Get(device, 'device-file', dbus_interface=PROPS_IFACE)
291 p = self.targets[device]['parent']287 p = self.targets[device]['parent']
292 if p and p in self.targets:288 if p and p in self.targets:
293 self.formatting.append(p)289 self.formatting.append(p)

Subscribers

People subscribed via source and target branches