fixed cdrom & disk+iso methods

This commit is contained in:
Sergey Bolshakov 2005-01-26 13:43:53 +00:00
parent 6c7895d197
commit 409d36bfb7
3 changed files with 20 additions and 7 deletions

View File

@ -71,12 +71,17 @@ static enum return_type do_with_device(char * dev_name, char * dev_model)
load_ramdisk();
umount(IMAGE_LOCATION);
}
insmod_compressed();
do_losetup(LIVE_DEVICE,get_ramdisk_path(NULL));
if(IS_LIVE)
my_mount(LIVE_DEVICE,STAGE2_LOCATION,LIVEFS, 0);
else
my_mount(LIVE_DEVICE,STAGE2_LOCATION,STAGE2FS, 0);
method_name = strdup("cdrom");
add_to_env("METHOD", method_name);
add_to_env("PREFIX", "/");
return RETURN_OK;
}

7
disk.c
View File

@ -260,7 +260,7 @@ static enum return_type try_with_device(char *dev_name)
} else {
/* LIVE install */
char p;
if (access(get_ramdisk_path(location_full), R_OK)) {
if (access(get_ramdisk_path(iso ? NULL : 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));
@ -270,8 +270,9 @@ static enum return_type try_with_device(char *dev_name)
}
log_message("found the " DISTRIB_NAME " Installation, good news!");
}
do_losetup(LIVE_DEVICE, get_ramdisk_path(location_full));
insmod_compressed();
do_losetup(LIVE_DEVICE, get_ramdisk_path(iso ? NULL : location_full));
my_mount(LIVE_DEVICE,STAGE2_LOCATION, (IS_LIVE) ? LIVEFS : STAGE2FS, 0);
method_name = strdup("disk");

15
init.c
View File

@ -519,9 +519,16 @@ int main(int argc, char **argv)
if ( statfs(IMAGE_LOCATION, &sfs) )
fatal_error("statfs "IMAGE_LOCATION);
/* if something is mounted under IMAGE_LOCATION ? */
if ( sfs.f_type != RAMFS_MAGIC && sfs.f_type != TMPFS_MAGIC )
if ( sfs.f_type != RAMFS_MAGIC && sfs.f_type != TMPFS_MAGIC ) {
if ( mount(IMAGE_LOCATION, "." IMAGE_LOCATION, NULL, MS_MOVE, NULL) )
fatal_error("overmounting image location");
/* test for nested mount: disk or nfs with iso image */
if ( statfs(IMAGE_LOCATION, &sfs) )
fatal_error("nested statfs "IMAGE_LOCATION);
if ( sfs.f_type != RAMFS_MAGIC && sfs.f_type != TMPFS_MAGIC )
if ( mount(IMAGE_LOCATION, "." IMAGE_LOCATION "/isolinux", NULL, MS_MOVE, NULL) )
fatal_error("overmounting nested image location");
}
umount("/sys");
umount("/proc/bus/usb");
@ -548,13 +555,13 @@ int main(int argc, char **argv)
dup2(fd, 2);
close(fd);
/* Spawn init */
printf(" done.\n");
/* Check for given init */
if (stat(stage2_argv[0], &ist) || !S_ISREG(ist.st_mode))
fatal_error("can't find init on root fs");
/* Spawn init */
printf(" done.\n");
execve(stage2_argv[0], stage2_argv, myenv);
fatal_error("stage2"); /* Failed to spawn init */
return 0;