From e813e1eb1a495f2d11b9c25c600d5c1fb32fe073 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 15 Jun 2004 09:16:41 +0000 Subject: redesign of the ISO image selection dialog, add an entry in the list to allow to use the directory as a mirror tree --- mdk-stage1/disk.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'mdk-stage1/disk.c') diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c index 3d47bc595..83ec0ae01 100644 --- a/mdk-stage1/disk.c +++ b/mdk-stage1/disk.c @@ -264,8 +264,8 @@ static enum return_type try_with_device(char *dev_name) #ifndef MANDRAKE_MOVE if (!stat(location_full, &statbuf) && S_ISDIR(statbuf.st_mode)) { char **file; - char *stage2_isos[100]; - int stage2_iso_number = 0; + char *stage2_isos[100] = { "Use directory as a mirror tree", "-----" }; + int stage2_iso_number = 2; log_message("\"%s\" exists and is a directory, looking for iso files", location_full); @@ -305,15 +305,30 @@ static enum return_type try_with_device(char *dev_name) stage2_isos[stage2_iso_number] = NULL; - if (stage2_iso_number > 0) { - results = ask_from_list("Please choose the ISO image to be used to install the " DISTRIB_NAME - " Distribution, or cancel to use this directory as a mirror tree.", - stage2_isos, file); - if (results == RETURN_OK) { - strcat(location_full, "/"); - strcat(location_full, *file); - log_message("installer will use ISO image \"%s\"", location_full); - } + if (stage2_iso_number > 2) { + do { + results = ask_from_list("Please choose the ISO image to be used to install the " + DISTRIB_NAME " Distribution.", + stage2_isos, file); + if (results == RETURN_BACK) { + umount(disk_own_mount); + return try_with_device(dev_name); + } else if (results == RETURN_OK) { + if (!strcmp(*file, stage2_isos[0])) { + /* use directory as a mirror tree */ + continue; + } else if (!strcmp(*file, stage2_isos[1])) { + /* the separator has been selected */ + results = RETURN_ERROR; + continue; + } else { + /* use selected ISO image */ + strcat(location_full, "/"); + strcat(location_full, *file); + log_message("installer will use ISO image \"%s\"", location_full); + } + } + } while (results == RETURN_ERROR); } else { log_message("no ISO image found in \"%s\" directory", location_full); } -- cgit v1.2.1