'disk' install method fixed.

WARNING: proto changed: get_ramdisk_path(char *)
This commit is contained in:
Sergey Bolshakov 2004-12-12 22:22:50 +00:00
parent 840f1c7f94
commit 68463187b0
5 changed files with 30 additions and 38 deletions

View File

@ -47,8 +47,8 @@ static int mount_that_cd_device(char * dev_name)
static int test_that_cd()
{
log_message("test file on cd: %s\n",get_ramdisk_path());
return access(get_ramdisk_path(), R_OK);
log_message("test file on cd: %s\n",get_ramdisk_path(NULL));
return access(get_ramdisk_path(NULL), R_OK);
}
@ -71,7 +71,7 @@ static enum return_type do_with_device(char * dev_name, char * dev_model)
load_ramdisk();
umount(IMAGE_LOCATION);
}
do_losetup(LIVE_DEVICE,get_ramdisk_path());
do_losetup(LIVE_DEVICE,get_ramdisk_path(NULL));
if(IS_LIVE)
my_mount(LIVE_DEVICE,STAGE2_LOCATION,LIVEFS, 0);
else

39
disk.c
View File

@ -26,6 +26,7 @@
#include <sys/mount.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include "stage1.h"
#include "frontend.h"
#include "modules.h"
@ -154,8 +155,6 @@ static enum return_type try_with_device(char *dev_name)
char device_fullname[50];
char location_full[500];
char * disk_own_mount = "/tmp/hdimage";
int major, minor, blocks;
char name[100];
@ -205,44 +204,38 @@ static enum return_type try_with_device(char *dev_name)
strcpy(device_fullname, "/dev/");
strcat(device_fullname, choice);
if (my_mount(device_fullname, disk_own_mount, "ext2", 0) == -1 &&
my_mount(device_fullname, disk_own_mount, "vfat", 0) == -1 &&
my_mount(device_fullname, disk_own_mount, "reiserfs", 0) == -1) {
if (my_mount(device_fullname, IMAGE_LOCATION, "ext2", 0) == -1 &&
my_mount(device_fullname, IMAGE_LOCATION, "vfat", 0) == -1 &&
my_mount(device_fullname, IMAGE_LOCATION, "reiserfs", 0) == -1) {
stg1_error_message("I can't find a valid filesystem (tried: ext2, vfat, reiserfs).");
return try_with_device(dev_name);
}
if (ask_from_entries_auto("Please enter the directory (or ISO image file) containing the " DISTRIB_NAME " Distribution.",
questions_location, &answers_location, 24, questions_location_auto, NULL) != RETURN_OK) {
umount(disk_own_mount);
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
strcpy(location_full, disk_own_mount);
strcpy(location_full, IMAGE_LOCATION);
strcat(location_full, "/");
strcat(location_full, answers_location[0]);
if (access(location_full, R_OK)) {
stg1_error_message("Directory or ISO image file could not be found on partition.\n"
"Here's a short extract of the files in the root of the partition:\n"
"%s", disk_extract_list_directory(disk_own_mount));
umount(disk_own_mount);
"%s", disk_extract_list_directory(IMAGE_LOCATION));
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
unlink(IMAGE_LOCATION);
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)) {
stg1_error_message("Could not mount file %s as an ISO image of the " DISTRIB_NAME " Distribution.", answers_location[0]);
umount(disk_own_mount);
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
} else
{
if(symlink(location_full, IMAGE_LOCATION))
perror("symlink");
}
if (IS_SPECIAL_STAGE2 || ramdisk_possible()) {
@ -253,33 +246,31 @@ static enum return_type try_with_device(char *dev_name)
"Here's a short extract of the files in the directory:\n"
"%s", disk_extract_list_directory(IMAGE_LOCATION));
loumount();
umount(disk_own_mount);
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
if (load_ramdisk() != RETURN_OK) {
stg1_error_message("Could not load program into memory.");
loumount();
umount(disk_own_mount);
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
} else {
/* LIVE install */
char p;
if (access(get_ramdisk_path(), R_OK)) {
if (access(get_ramdisk_path(location_full), R_OK)) {
stg1_error_message("I can't find the " DISTRIB_NAME " Distribution in the specified directory. "
"Here's a short extract of the files in the directory:\n"
"%s", disk_extract_list_directory(IMAGE_LOCATION));
loumount();
umount(disk_own_mount);
umount(IMAGE_LOCATION);
return try_with_device(dev_name);
}
log_message("found the " DISTRIB_NAME " Installation, good news!");
}
if (IS_RESCUE) {
loumount();
umount(disk_own_mount);
}
do_losetup(LIVE_DEVICE, get_ramdisk_path(location_full));
my_mount(LIVE_DEVICE,STAGE2_LOCATION, (IS_LIVE) ? LIVEFS : STAGE2FS, 0);
method_name = strdup("disk");
return RETURN_OK;

View File

@ -656,7 +656,7 @@ enum return_type nfs_prepare(void)
continue;
}
if (access(get_ramdisk_path(), R_OK)) {
if (access(get_ramdisk_path(NULL), R_OK)) {
stg1_error_message("That NFS volume does not seem to contain the " DISTRIB_NAME " Distribution.");
umount(IMAGE_LOCATION);
results = RETURN_BACK;
@ -668,7 +668,7 @@ enum return_type nfs_prepare(void)
insmod_compressed();
do_losetup(LIVE_DEVICE,get_ramdisk_path());
do_losetup(LIVE_DEVICE,get_ramdisk_path(NULL));
if(IS_LIVE)
my_mount(LIVE_DEVICE,STAGE2_LOCATION,LIVEFS, 0);

View File

@ -337,12 +337,13 @@ char * get_ramdisk_realname(void)
return strdup(img_name);
}
char * get_ramdisk_path(void)
char * get_ramdisk_path(char *mount_path)
{
char * img_name[500];
char * mount_path = IMAGE_LOCATION;
char * st2_path = get_ramdisk_realname();
strcpy(img_name, mount_path);
/* FIXME */
strcpy(img_name, mount_path ? mount_path : IMAGE_LOCATION);
strcat(img_name, st2_path);
return strdup(img_name);
}

View File

@ -41,7 +41,7 @@ char ** grab_env(void);
char ** list_directory(char * direct);
int string_array_length(char ** a);
int do_losetup(char * device, char * target);
char * get_ramdisk_path(void);
char * get_ramdisk_path(char *);
struct param_elem
{