summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-10-31 17:46:31 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-10-31 17:46:31 +0000
commit91d57c9ff624fe2b0b211d630afaf1c5ba175206 (patch)
treeb9fcd11830cb48007a8f70ef81de23cdf97ee67b
parent6ec6e73e61f0afe20de7155d58e752ddee862298 (diff)
downloaddrakx-91d57c9ff624fe2b0b211d630afaf1c5ba175206.tar
drakx-91d57c9ff624fe2b0b211d630afaf1c5ba175206.tar.gz
drakx-91d57c9ff624fe2b0b211d630afaf1c5ba175206.tar.bz2
drakx-91d57c9ff624fe2b0b211d630afaf1c5ba175206.tar.xz
drakx-91d57c9ff624fe2b0b211d630afaf1c5ba175206.zip
copy "boot" and "always" clp's in memory
-rw-r--r--mdk-stage1/stage1.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index 88d4eaf6a..101573d7c 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -389,7 +389,7 @@ int mandrake_move_pre(void)
}
-static enum return_type handle_clp(char* clp, char* live, char* location_live, char* location_mount, int* is_symlink)
+static enum return_type handle_clp(char* clp, char* live, char* location_live, char* location_mount, int* is_symlink, char* clp_tmpfs)
{
if (IS_LIVE || access(clp, R_OK)) {
log_message("no %s found (or disabled), trying to fallback on plain tree", clp);
@@ -404,6 +404,16 @@ static enum return_type handle_clp(char* clp, char* live, char* location_live, c
}
}
+ if (clp_tmpfs) {
+ int ret;
+ init_progression("Loading...", file_size(clp));
+ ret = copy_file(clp, clp_tmpfs, update_progression);
+ end_progression();
+ if (ret != RETURN_OK)
+ return ret;
+ clp = clp_tmpfs;
+ }
+
if (lomount(clp, location_mount, NULL, 1)) {
stg1_error_message("Could not mount compressed loopback :(.");
return RETURN_ERROR;
@@ -421,41 +431,20 @@ int mandrake_move_post(void)
int boot__real_is_symlink_to_raw = 0;
int always__real_is_symlink_to_raw = 0;
int main__real_is_symlink_to_raw = 0;
- char* clp = IMAGE_LOCATION "/live_tree_boot.clp";
- char* clp_tmpfs = SLASH_LOCATION "/live_tree_boot.clp";
- char* live = IMAGE_LOCATION "/live_tree_boot/usr/bin/runstage2.pl";
- int ret;
- if (IS_LIVE || access(clp, R_OK)) {
- log_message("no %s found (or disabled), trying to fallback on plain tree", clp);
- if (!access(live, R_OK)) {
- if (scall(symlink(IMAGE_LOCATION "/live_tree_boot", BOOT_LOCATION), "symlink"))
- return RETURN_ERROR;
- boot__real_is_symlink_to_raw = 1;
- goto handle_clps;
- } else {
- log_message("move: can't find %s nor %s, proceeding with live_tree.clp hoping files will be there", clp, live);
- goto handle_clps;
- }
- }
-
- init_progression("Loading startup program into memory...", file_size(clp));
- ret = copy_file(clp, clp_tmpfs, update_progression);
- end_progression();
- if (ret != RETURN_OK)
- return ret;
- if (lomount(clp_tmpfs, BOOT_LOCATION, NULL, 1))
- stg1_error_message("Could not mount boot compressed loopback :(.");
+ if (handle_clp(IMAGE_LOCATION "/live_tree_boot.clp", IMAGE_LOCATION "/live_tree_boot/usr/bin/runstage2",
+ IMAGE_LOCATION "/live_tree_boot", BOOT_LOCATION,
+ &boot__real_is_symlink_to_raw, SLASH_LOCATION "/live_tree_boot.clp") != RETURN_OK)
+ return RETURN_ERROR;
- handle_clps:
if (handle_clp(IMAGE_LOCATION "/live_tree_always.clp", IMAGE_LOCATION "/live_tree_always/bin/bash",
IMAGE_LOCATION "/live_tree_always", ALWAYS_LOCATION,
- &always__real_is_symlink_to_raw) != RETURN_OK)
+ &always__real_is_symlink_to_raw, SLASH_LOCATION "/live_tree_always.clp") != RETURN_OK)
return RETURN_ERROR;
if (handle_clp(IMAGE_LOCATION "/live_tree.clp", IMAGE_LOCATION "/live_tree/etc/fstab",
IMAGE_LOCATION "/live_tree", IMAGE_LOCATION_REAL,
- &main__real_is_symlink_to_raw) != RETURN_OK)
+ &main__real_is_symlink_to_raw, NULL) != RETURN_OK)
return RETURN_ERROR;
if (scall(!(f = fopen(IMAGE_LOCATION_REAL "/move/symlinks", "rb")), "fopen[" IMAGE_LOCATION_REAL "/move/symlinks]"))