summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/disk.c
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-06-11 14:08:13 +0000
committerOlivier Blin <oblin@mandriva.org>2004-06-11 14:08:13 +0000
commit99a03f82cc8c7deffcfc0cac4587872c44b104e7 (patch)
tree403a62037587cf22828870de13dbd6a4d13ead78 /mdk-stage1/disk.c
parent3ed3423a6b5d503c99626d2ad2d82e25587ba57d (diff)
downloaddrakx-99a03f82cc8c7deffcfc0cac4587872c44b104e7.tar
drakx-99a03f82cc8c7deffcfc0cac4587872c44b104e7.tar.gz
drakx-99a03f82cc8c7deffcfc0cac4587872c44b104e7.tar.bz2
drakx-99a03f82cc8c7deffcfc0cac4587872c44b104e7.tar.xz
drakx-99a03f82cc8c7deffcfc0cac4587872c44b104e7.zip
let the user choose between ISO images containing a stage2 installer if a directory containing ISO images has been specified
Diffstat (limited to 'mdk-stage1/disk.c')
-rw-r--r--mdk-stage1/disk.c60
1 files changed, 58 insertions, 2 deletions
diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c
index 331767226..bcf642642 100644
--- a/mdk-stage1/disk.c
+++ b/mdk-stage1/disk.c
@@ -201,7 +201,7 @@ static int try_mount(char * dev, char * location)
static enum return_type try_with_device(char *dev_name)
{
- char * questions_location[] = { "Directory or ISO image", NULL };
+ char * questions_location[] = { "Directory or ISO images directory or ISO image", NULL };
char * questions_location_auto[] = { "directory", NULL };
static char ** answers_location = NULL;
char location_full[500];
@@ -232,7 +232,7 @@ static enum return_type try_with_device(char *dev_name)
if (results != RETURN_OK)
return results;
}
-
+
if (try_mount(choice, disk_own_mount)) {
stg1_error_message("I can't find a valid filesystem (tried: ext2, vfat, ntfs, reiserfs).");
return try_with_device(dev_name);
@@ -258,6 +258,62 @@ static enum return_type try_with_device(char *dev_name)
unlink(IMAGE_LOCATION);
+#ifndef MANDRAKE_MOVE
+ if (!stat(location_full, &statbuf) && S_ISDIR(statbuf.st_mode)) {
+ char **file;
+ char *stage2_isos[100];
+ int stage2_iso_number = 0;
+
+ log_message("\"%s\" exists and is a directory, looking for iso files", location_full);
+
+ for (file = list_directory(location_full); *file; file++) {
+ char isofile[500], install_location[600];
+
+ if (strstr(*file, ".iso") != *file + strlen(*file) - 4)
+ /* file doesn't end in .iso, skipping */
+ continue;
+
+ strcpy(isofile, location_full);
+ strcat(isofile, "/");
+ strcat(isofile, *file);
+
+ if (lomount(isofile, IMAGE_LOCATION, &loopdev, 0)) {
+ log_message("unable to mount iso file \"%s\", skipping", isofile);
+ continue;
+ }
+
+ strcpy(install_location, IMAGE_LOCATION);
+
+ if (IS_SPECIAL_STAGE2 || ramdisk_possible())
+ strcat(install_location, get_ramdisk_realname()); /* RAMDISK install */
+ else
+ strcat(install_location, LIVE_LOCATION); /* LIVE install */
+
+ if (access(install_location, R_OK)) {
+ log_message("ISO image \"%s\" doesn't contain stage2 installer", isofile);
+ } else {
+ log_message("stage2 installer found in ISO image is \"%s\"", isofile);
+ stage2_isos[stage2_iso_number++] = strdup(*file);
+ }
+
+ umount(IMAGE_LOCATION);
+ }
+
+ 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 as a mirrored directory", stage2_isos, file);
+ if (results == RETURN_OK) {
+ strcat(location_full, "/");
+ strcat(location_full, *file);
+ log_message("installer will use ISO image \"%s\"", location_full);
+ }
+ } else {
+ log_message("no ISO image found in \"%s\" directory", location_full);
+ }
+ }
+#endif
+
if (!stat(location_full, &statbuf) && !S_ISDIR(statbuf.st_mode)) {
log_message("%s exists and is not a directory, assuming this is an ISO image", location_full);
if (lomount(location_full, IMAGE_LOCATION, &loopdev, 0)) {