summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/stage1.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-10-31 16:13:14 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-10-31 16:13:14 +0000
commit92460f66390ef105485b40c4dd8e98e2e2d60163 (patch)
treead206936863e651e2c258732caf1cb5aa046f8b4 /mdk-stage1/stage1.c
parent91df42593f4b041702b829d6f789f3caf58fcfed (diff)
downloaddrakx-backup-do-not-use-92460f66390ef105485b40c4dd8e98e2e2d60163.tar
drakx-backup-do-not-use-92460f66390ef105485b40c4dd8e98e2e2d60163.tar.gz
drakx-backup-do-not-use-92460f66390ef105485b40c4dd8e98e2e2d60163.tar.bz2
drakx-backup-do-not-use-92460f66390ef105485b40c4dd8e98e2e2d60163.tar.xz
drakx-backup-do-not-use-92460f66390ef105485b40c4dd8e98e2e2d60163.zip
save /etc/resolv.conf in move mode
Diffstat (limited to 'mdk-stage1/stage1.c')
-rw-r--r--mdk-stage1/stage1.c47
1 files changed, 11 insertions, 36 deletions
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index 876c40867..88d4eaf6a 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -424,6 +424,7 @@ int mandrake_move_post(void)
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);
@@ -438,42 +439,13 @@ int mandrake_move_post(void)
}
}
- {
- FILE * from, * to;
- size_t quantity __attribute__((aligned(16))), overall = 0;
- char buf[4096] __attribute__((aligned(4096)));
-
- log_message("move: copying live_tree_boot.clp to tmpfs");
- if (scall(!(from = fopen(clp, "rb")), "fopen"))
- return RETURN_ERROR;
- if (scall(!(to = fopen(clp_tmpfs, "w")), "fopen"))
- return RETURN_ERROR;
-
- init_progression("Loading startup program into memory...", file_size(clp));
-
- do {
- if ((quantity = fread(buf, 1, sizeof(buf), from)) > 0) {
- if (fwrite(buf, 1, quantity, to) != quantity) {
- log_message("short write (%s)", strerror(errno));
- return RETURN_ERROR;
- }
- }
- overall += quantity;
- update_progression(overall);
- } while (!feof(from) && !ferror(from) && !ferror(to));
-
- end_progression();
-
- if (ferror(from) || ferror(to)) {
- log_message("an error occured while copying live_tree_boot.clp (%s)", strerror(errno));
- return RETURN_ERROR;
- }
- fclose(from);
- fclose(to);
-
- if (lomount(clp_tmpfs, BOOT_LOCATION, NULL, 1))
- stg1_error_message("Could not mount boot compressed loopback :(.");
- }
+ 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 :(.");
handle_clps:
if (handle_clp(IMAGE_LOCATION "/live_tree_always.clp", IMAGE_LOCATION "/live_tree_always/bin/bash",
@@ -537,6 +509,9 @@ int mandrake_move_post(void)
return RETURN_ERROR;
}
+ mkdir(SLASH_LOCATION "/etc", 0755);
+ copy_file("/etc/resolv.conf", SLASH_LOCATION "/etc/resolv.conf", NULL);
+
if (IS_DEBUGSTAGE1)
while (1);