diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2001-03-18 17:50:06 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2001-03-18 17:50:06 +0000 |
commit | 483f665e8a7772bf899f89bbc3cb457d49002890 (patch) | |
tree | 7eb88ce331fd57a2d7c384ed9cf6388c9c775ef6 | |
parent | b4a463d96dd6e6792f8cc9ce53178b6647a12eaf (diff) | |
download | drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.tar drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.tar.gz drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.tar.bz2 drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.tar.xz drakx-backup-do-not-use-483f665e8a7772bf899f89bbc3cb457d49002890.zip |
fix for hd-install when you provide a not valid ISO (cd #2 for example)
-rw-r--r-- | mdk-stage1/disk.c | 12 | ||||
-rw-r--r-- | mdk-stage1/lomount.c | 33 | ||||
-rw-r--r-- | mdk-stage1/lomount.h | 2 |
3 files changed, 26 insertions, 21 deletions
diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c index 0a15f0e67..d6aa1596d 100644 --- a/mdk-stage1/disk.c +++ b/mdk-stage1/disk.c @@ -108,7 +108,7 @@ static enum return_type try_with_device(char *dev_name) if (my_mount(device_fullname, disk_own_mount, "ext2") == -1 && my_mount(device_fullname, disk_own_mount, "vfat") == -1 && my_mount(device_fullname, disk_own_mount, "reiserfs") == -1) { - error_message("I can't find a valid filesystem."); + error_message("I can't find a valid filesystem (tried: ext2, vfat, reiserfs)."); return try_with_device(dev_name); } @@ -149,11 +149,13 @@ static enum return_type try_with_device(char *dev_name) "(I need the subdirectory " RAMDISK_LOCATION ")\n" "Here's a short extract of the files in the directory:\n" "%s", disk_extract_list_directory(IMAGE_LOCATION)); + loumount(); umount(disk_own_mount); return try_with_device(dev_name); } if (load_ramdisk() != RETURN_OK) { error_message("Could not load program into memory."); + loumount(); umount(disk_own_mount); return try_with_device(dev_name); } @@ -165,6 +167,7 @@ static enum return_type try_with_device(char *dev_name) "(I need the subdirectory " LIVE_LOCATION ")\n" "Here's a short extract of the files in the directory:\n" "%s", disk_extract_list_directory(IMAGE_LOCATION)); + loumount(); umount(disk_own_mount); return try_with_device(dev_name); } @@ -172,14 +175,17 @@ static enum return_type try_with_device(char *dev_name) error_message("The " DISTRIB_NAME " Distribution seems to be copied on a Windows partition. " "You need more memory to perform an installation from a Windows partition. " "Another solution if to copy the " DISTRIB_NAME " Distribution on a Linux partition."); + loumount(); umount(disk_own_mount); return try_with_device(dev_name); } log_message("found the " DISTRIB_NAME " Installation, good news!"); } - if (IS_RESCUE) - umount(IMAGE_LOCATION); + if (IS_RESCUE) { + loumount(); + umount(disk_own_mount); + } method_name = strdup("disk"); return RETURN_OK; diff --git a/mdk-stage1/lomount.c b/mdk-stage1/lomount.c index 281de4a93..7d34948b0 100644 --- a/mdk-stage1/lomount.c +++ b/mdk-stage1/lomount.c @@ -110,23 +110,25 @@ set_loop (const char *device, const char *file) return 0; } -int -del_loop (const char *device) + +char * loopdev = "/dev/loop3"; /* Ugly. But do I care? */ + +void +del_loop(void) { int fd; - if ((fd = open (device, O_RDONLY)) < 0) - return 1; + if ((fd = open (loopdev, O_RDONLY)) < 0) + return; if (ioctl (fd, LOOP_CLR_FD, 0) < 0) - return 1; + return; close (fd); - return 0; } -char * loopdev = "/dev/loop3"; /* Ugly. But do I care? */ +static char * where_mounted = NULL; int lomount(char *loopfile, char *where) @@ -145,11 +147,12 @@ lomount(char *loopfile, char *where) } if (my_mount(loopdev, where, "iso9660")) { - del_loop(loopdev); + del_loop(); return 1; } - log_message("lomount succeded for %s on %s", loopfile, where); + where_mounted = strdup(where); + log_message("lomount succeeded for %s on %s", loopfile, where); return 0; } @@ -157,15 +160,11 @@ lomount(char *loopfile, char *where) int loumount() { - if (umount(loopdev)) { - log_perror("loumount"); - return 1; - } - - if (del_loop(loopdev)) { - log_perror("del_loop"); - return 1; + if (where_mounted) { + umount(where_mounted); + where_mounted = NULL; } + del_loop(); return 0; } diff --git a/mdk-stage1/lomount.h b/mdk-stage1/lomount.h index f298fe341..3b8a30ac1 100644 --- a/mdk-stage1/lomount.h +++ b/mdk-stage1/lomount.h @@ -16,6 +16,6 @@ #define LOMOUNT_H int lomount(char *loopfile, char *where); -int loumount(); +int loumount(void); #endif |