diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-11-05 14:39:22 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-11-05 14:39:22 +0000 |
commit | 2c935f469031f43ee5012d1e144d4afa623f44a2 (patch) | |
tree | 36456bb8e693fe31fa090241da8b752212eb4262 /mdk-stage1 | |
parent | eee0b9790b3c306988d2771d6e72115f6ff47466 (diff) | |
download | drakx-backup-do-not-use-2c935f469031f43ee5012d1e144d4afa623f44a2.tar drakx-backup-do-not-use-2c935f469031f43ee5012d1e144d4afa623f44a2.tar.gz drakx-backup-do-not-use-2c935f469031f43ee5012d1e144d4afa623f44a2.tar.bz2 drakx-backup-do-not-use-2c935f469031f43ee5012d1e144d4afa623f44a2.tar.xz drakx-backup-do-not-use-2c935f469031f43ee5012d1e144d4afa623f44a2.zip |
keep the tmpfs and rescue in /tmp/stage2
(this allows to mount the rescue read-only)
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/stage1.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index 3f4427281..c25e3d68f 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -376,7 +376,7 @@ static void method_select_and_prepare(void) return method_select_and_prepare(); } -enum return_type create_initial_fs(char* symlinks, char* devices) +static enum return_type create_initial_fs_symlinks(char* symlinks) { FILE *f; char buf[5000]; @@ -397,6 +397,13 @@ enum return_type create_initial_fs(char* symlinks, char* devices) return RETURN_ERROR; } fclose(f); + return RETURN_OK; +} + +static enum return_type create_initial_fs_devices(char* devices) +{ + FILE *f; + char buf[5000]; // need to create the few devices needed to start up stage2 in a decent manner, we can't symlink or they will keep CD busy if (scall(mkdir(SLASH_LOCATION "/dev", 0755), "mkdir")) @@ -475,7 +482,8 @@ int mandrake_move_post(void) if (scall(symlink(STAGE2_LOCATION_ROOTED "/usr", SLASH_LOCATION "/usr"), "symlink")) return RETURN_ERROR; - if (create_initial_fs(STAGE2_LOCATION "/move/symlinks", STAGE2_LOCATION "/move/devices") != RETURN_OK) + if (create_initial_fs_symlinks(STAGE2_LOCATION "/move/symlinks") != RETURN_OK || + create_initial_fs_devices(STAGE2_LOCATION "/move/devices") != RETURN_OK) return RETURN_ERROR; if (boot__real_is_symlink_to_raw) { @@ -538,29 +546,32 @@ int do_pivot_root(void) void finish_preparing(void) { - if (!IS_RESCUE) { #ifdef MANDRAKE_MOVE - if (mandrake_move_post() != RETURN_OK) - stg1_fatal_message("Fatal error when launching MandrakeMove."); + if (mandrake_move_post() != RETURN_OK) + stg1_fatal_message("Fatal error when launching MandrakeMove."); #else - mkdir(SLASH_LOCATION "/etc", 0755); - mkdir(SLASH_LOCATION "/var", 0755); - if (create_initial_fs(STAGE2_LOCATION "/usr/share/symlinks", - STAGE2_LOCATION "/usr/share/devices") != RETURN_OK) + mkdir(SLASH_LOCATION "/etc", 0755); + mkdir(SLASH_LOCATION "/var", 0755); + if (IS_RESCUE) { + if (create_initial_fs_symlinks(STAGE2_LOCATION "/usr/share/symlinks") != RETURN_OK) stg1_fatal_message("Fatal error finishing initialization."); + + } else { + if (create_initial_fs_symlinks(STAGE2_LOCATION "/usr/share/symlinks") != RETURN_OK || + create_initial_fs_devices(STAGE2_LOCATION "/usr/share/devices") != RETURN_OK) + stg1_fatal_message("Fatal error finishing initialization."); + } #endif - copy_file("/etc/resolv.conf", SLASH_LOCATION "/etc/resolv.conf", NULL); - mkdir(SLASH_LOCATION "/modules", 0755); - copy_file("/modules/modules.dep", SLASH_LOCATION "/modules/modules.dep", NULL); + copy_file("/etc/resolv.conf", SLASH_LOCATION "/etc/resolv.conf", NULL); + mkdir(SLASH_LOCATION "/modules", 0755); + copy_file("/modules/modules.dep", SLASH_LOCATION "/modules/modules.dep", NULL); - umount("/tmp/tmpfs"); - do_pivot_root(); - - if (file_size("/sbin/init") == -1) - stg1_fatal_message("Fatal error giving hand to second stage."); - } + umount("/tmp/tmpfs"); + do_pivot_root(); + if (file_size("/sbin/init") == -1) + stg1_fatal_message("Fatal error giving hand to second stage."); if (shell_pid != 0) { int fd; |