From 35b60523ce6b2e32f33dee7a09ce505cc5512be6 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 4 Nov 2004 12:16:19 +0000 Subject: LIVE_LOCATION is better named LIVE_LOCATION_REL without the leading "/" --- mdk-stage1/config-stage1.h | 3 ++- mdk-stage1/directory.c | 6 +++--- mdk-stage1/modules.c | 8 +++++++- mdk-stage1/network.c | 2 +- mdk-stage1/stage1.c | 8 ++++---- mdk-stage1/tools.c | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/mdk-stage1/config-stage1.h b/mdk-stage1/config-stage1.h index e1b717876..4b31f915f 100644 --- a/mdk-stage1/config-stage1.h +++ b/mdk-stage1/config-stage1.h @@ -27,7 +27,6 @@ #define RAMDISK_COMPRESSION_RATIO 1.95 -#define LIVE_LOCATION "/install/stage2/live/" #define RAMDISK_LOCATION "/install/stage2/" #define SLASH_LOCATION "/sysroot" #define STAGE2_LOCATION SLASH_LOCATION "/tmp/stage2" @@ -47,6 +46,8 @@ #else #define DISTRIB_NAME "Mandrakelinux" + +#define LIVE_LOCATION_REL "install/stage2/live/" #define IMAGE_LOCATION_DIR SLASH_LOCATION "/tmp/" #define IMAGE_LOCATION IMAGE_LOCATION_DIR "image" #define IMAGE_LOCATION_REAL "/tmp/image" diff --git a/mdk-stage1/directory.c b/mdk-stage1/directory.c index 9faa5e1dc..05beed1bc 100644 --- a/mdk-stage1/directory.c +++ b/mdk-stage1/directory.c @@ -160,10 +160,10 @@ enum return_type try_with_directory(char *directory, char *method_live, char *me if (access(IMAGE_LOCATION "/live_tree/etc/fstab", R_OK) && access(IMAGE_LOCATION "/live_tree.clp", R_OK)) { #else char p; - if (access(IMAGE_LOCATION LIVE_LOCATION, R_OK)) { + if (access(IMAGE_LOCATION "/" LIVE_LOCATION_REL, R_OK)) { #endif stg1_error_message("I can't find the " DISTRIB_NAME " Distribution in the specified directory. " - "(I need the subdirectory " LIVE_LOCATION ")\n" + "(I need the subdirectory " LIVE_LOCATION_REL ")\n" "Here's a short extract of the files in the directory:\n" "%s", extract_list_directory(IMAGE_LOCATION)); umount(IMAGE_LOCATION); @@ -171,7 +171,7 @@ enum return_type try_with_directory(char *directory, char *method_live, char *me return RETURN_BACK; } #ifndef MANDRAKE_MOVE - if (readlink(IMAGE_LOCATION LIVE_LOCATION "/usr/bin/runinstall2", &p, 1) != 1) { + if (readlink(IMAGE_LOCATION "/" LIVE_LOCATION_REL "/usr/bin/runinstall2", &p, 1) != 1) { stg1_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 is to copy the " DISTRIB_NAME " Distribution on a Linux partition."); diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index a0876416e..654873146 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -373,7 +373,13 @@ static enum insmod_return insmod_with_deps(const char * mod_name, char * options return INSMOD_OK; log_message("needs %s", mod_name); - return insmod_archived_file(mod_name, options, allow_modules_floppy); + { + char *file = asprintf_("/modules/%s%s", mod_name, kernel_module_extension()); + if (access(file, R_OK) == 0) + return insmod_local_file(file, options); + else + return insmod_archived_file(mod_name, options, allow_modules_floppy); + } } diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c index 17c39dc96..b5f95791f 100644 --- a/mdk-stage1/network.c +++ b/mdk-stage1/network.c @@ -968,7 +968,7 @@ enum return_type ftp_prepare(void) } strcpy(modules_cz, location_full); - strcat(modules_cz, LIVE_LOCATION "lib/modules.cz-"); + strcat(modules_cz, "/" LIVE_LOCATION_REL "lib/modules.cz-"); strcat(modules_cz, kernel_uname.release); log_message("checking presence of modules.cz file : \"%s\"", modules_cz); diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index 03cd10515..efe50cddd 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -564,8 +564,8 @@ void finish_preparing(void) mkdir(SLASH_LOCATION "/etc", 0755); mkdir(SLASH_LOCATION "/var", 0755); /* STAGE2_LOCATION is wrong for live installs before pivot_root */ - if ((!IS_RAMDISK && create_initial_fs(IMAGE_LOCATION LIVE_LOCATION "/usr/share/symlinks", - IMAGE_LOCATION LIVE_LOCATION "/usr/share/devices") != RETURN_OK) + if ((!IS_RAMDISK && create_initial_fs(IMAGE_LOCATION "/" LIVE_LOCATION_REL "/usr/share/symlinks", + IMAGE_LOCATION "/" LIVE_LOCATION_REL "/usr/share/devices") != RETURN_OK) || (IS_RAMDISK && create_initial_fs(STAGE2_LOCATION "/usr/share/symlinks", STAGE2_LOCATION "/usr/share/devices") != RETURN_OK)) stg1_fatal_message("Fatal error finishing initialization."); @@ -662,8 +662,8 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) #ifndef MANDRAKE_MOVE if (!IS_RAMDISK) - if (symlink(IMAGE_LOCATION_REAL LIVE_LOCATION, STAGE2_LOCATION) != 0) - log_perror("symlink from " IMAGE_LOCATION_REAL LIVE_LOCATION " to " STAGE2_LOCATION " failed"); + if (symlink(IMAGE_LOCATION_REAL "/" LIVE_LOCATION_REL, STAGE2_LOCATION) != 0) + log_perror("symlink from " IMAGE_LOCATION_REAL "/" LIVE_LOCATION_REL " to " STAGE2_LOCATION " failed"); #endif if (interactive_pid != 0) diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c index a89edf613..ddc939012 100644 --- a/mdk-stage1/tools.c +++ b/mdk-stage1/tools.c @@ -227,7 +227,7 @@ int image_has_stage2() #ifdef MANDRAKE_MOVE return access(IMAGE_LOCATION "/live_tree.clp", R_OK) == 0; #else - return access(IMAGE_LOCATION LIVE_LOCATION, R_OK) == 0; + return access(IMAGE_LOCATION "/" LIVE_LOCATION_REL, R_OK) == 0; #endif } -- cgit v1.2.1