Re: debian-installer patch followup #2
On Wed, 2002-08-28 at 11:02, Wartan Hachaturow wrote: > Some time ago I've synced autopartkit with 1.6. It's pretty easy > to do this with 1.4, since API is different mostly in function names ;) > I've also synced partkit, but there has been some changes ;) since > then. I could do a merge and commit it, if it's needed.. Please do; I think we should be using the latest version of parted. We're probably going to have to get used to using bleeding-edge versions of parted, as we might need to port it to new architectures (e.g. sparc). -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: debian-installer patch followup #2
On Wed, Aug 28, 2002 at 12:27:40PM +0200, Martin Sj?gren wrote: > Hmm. partkit seems to be using parted 1.4. The version in unstable is > 1.6. Sucks to be me I suppose, the testing version is still 1.4, but who > knows when 1.6 will move to testing. The API is very different, which I > encountered when I tried to get python-parted to compile on 1.6 (without > success I might add). Some time ago I've synced autopartkit with 1.6. It's pretty easy to do this with 1.4, since API is different mostly in function names ;) I've also synced partkit, but there has been some changes ;) since then. I could do a merge and commit it, if it's needed.. -- Regards, Wartan. "Computers are not intelligent. They only think they are." -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: debian-installer patch followup #2
ons 2002-08-28 klockan 04.13 skrev Michael Cardenas: > Here's my final patch. This one fixes the two fixme's in partkit.c, > one for getting a list of devices, the other for getting a default. I > just use the first device returned as the default. Hmm. partkit seems to be using parted 1.4. The version in unstable is 1.6. Sucks to be me I suppose, the testing version is still 1.4, but who knows when 1.6 will move to testing. The API is very different, which I encountered when I tried to get python-parted to compile on 1.6 (without success I might add). For now, I think we should add a build-depends on libparted1.4-dev at least. Regards, Martin signature.asc Description: Detta =?ISO-8859-1?Q?=E4r?= en digitalt signeradmeddelandedel
debian-installer patch followup #2
Here's my final patch. This one fixes the two fixme's in partkit.c, one for getting a list of devices, the other for getting a default. I just use the first device returned as the default. michael -- michael cardenas | lead software engineer | lindows.com | hyperpoem.net "When you understand one thing through and through, you understand everything." - Shunryu Suzuki --- partkit.c.orig Tue Aug 27 08:23:42 2002 +++ partkit.c Tue Aug 27 19:11:27 2002 @@ -406,28 +406,88 @@ } +char *partkit_get_devices(PedDevice *dev) +{ + char *ptr = 0; + int drivelistlen = 0; + + ped_device_probe_all(); + + //mbc - unfortunately, do two passes for now to do the malloc... + while((dev = ped_device_get_next(dev))) +{ + drivelistlen += strlen(dev->path); + drivelistlen += 2; +} + + if(drivelistlen) + { +ptr = (char *)malloc(drivelistlen); + +if(ptr) + { +*ptr = 0; +dev = NULL; + +while((dev = ped_device_get_next(dev))) + { +if(*ptr == 0) + strcpy(ptr, dev->path); +else if (*ptr != 0) + { +strcat(ptr, ", "); +strcat(ptr, dev->path); + } + } + } + + } + + return ptr; + +} + +//mbc - for now, just use the first device +char *partkit_get_default_device(void) +{ + PedDevice *dev = NULL; + char *ptr = 0; + + dev = ped_device_get_next(dev); + + ptr = (char *)malloc(strlen(dev->path)); + + strcpy(ptr, dev->path); + + return ptr; +} int main (int argc, char *argv[]) { int finished = 0; PedDevice *dev = NULL; - char *ptr; + char *ptr = 0; client = debconfclient_new (); client->command (client, "title", "Partition Editor", NULL); + //mbc - should install an exception handler here + ped_init(); + do { - /* FIXME: how to get a list of available devices ? */ - ptr = /* get_device_list() */ "/dev/hdb"; - + ptr = partkit_get_devices(dev); client->command (client, "subst", "partkit/select_device", "choices", ptr, NULL); - /*FIXME: how to get a default device? */ + free(ptr); + + ptr = partkit_get_default_device(); + client->command (client, "subst", "partkit/select_device", "default", ptr, NULL); + free(ptr); if ((dev = ped_device_get (argv[1])) == NULL) partkit_error (1); @@ -452,6 +512,8 @@ finished = 1; } while (!finished); + + ped_done(); return 0; } msg21622/pgp0.pgp Description: PGP signature