On Fri, Aug 20, 2010 at 3:30 PM, Richard Shaw <[email protected]> wrote:
> On Fri, Aug 20, 2010 at 10:05 AM, Jasper Hartline
> <[email protected]> wrote:
>>> I'll keep banging away at it. I'm digging through the pyparted source.
>>>
>>> Richard
>>
>> Here is what I have done, put a comment in stating we need to use
>> pyparted in the format() function.
>>
>> It is starting to get ugly in setup() where it starts
>> on dirs = with the list, but I can migrate most of that to functions
>> before I go further.
>>
>> http://autopsy.liveprojects.info/scripts/mkbiarch.py
>
> Ok, only some slight updates:
>
> def partition(temp_image):    # Found a way to get the sectors through 
> pyparted
>    device = parted.getDevice(temp_image)
>    disk = freshDisk(device, 'msdos')
>    constraint = parted.Constraint(device=device)
>    geometry = parted.Geometry(device=device, start=1,
> end=(constraint.maxSize-1))
>    partition = parted.Partition(disk=disk, type=82, geometry=geometry)
>    disk.addPartition(partition=partition, constraint=constraint)
>    disk.commit()

Ok, doing math in the function call bothered me and I figured it could
be a little more descriptive...

def partition(temp_image):
   """Creates a single partition using all available space in the
given empty device."""
   device = parted.getDevice(temp_image)
   disk = freshDisk(device, 'msdos')
   constraint = parted.Constraint(device=device)

   start_sector = 1
   end_sector = constraint.maxSize - 1
   geometry = parted.Geometry(device=device, start=start_sector, end=end_sector)

   partition = parted.Partition(disk=disk, type=82, geometry=geometry)
   disk.addPartition(partition=partition, constraint=constraint)
   disk.commit()
---
Richard
--
livecd mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/livecd

Reply via email to