summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-11-05 14:39:22 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-11-05 14:39:22 +0000
commit2c935f469031f43ee5012d1e144d4afa623f44a2 (patch)
tree36456bb8e693fe31fa090241da8b752212eb4262
parenteee0b9790b3c306988d2771d6e72115f6ff47466 (diff)
downloaddrakx-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)
-rw-r--r--mdk-stage1/stage1.c47
-rwxr-xr-xrescue/tree/etc/rc.sysinit6
-rw-r--r--rescue/tree/usr/share/symlinks10
3 files changed, 44 insertions, 19 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;
diff --git a/rescue/tree/etc/rc.sysinit b/rescue/tree/etc/rc.sysinit
index 27fdb8187..675863ddf 100755
--- a/rescue/tree/etc/rc.sysinit
+++ b/rescue/tree/etc/rc.sysinit
@@ -6,9 +6,13 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
echo -e "\t\t\tWelcome to \\033[1;36mMandrake\\033[0;39m Linux"
-action "Mounting proc filesystem" mount -n -t proc /proc /proc
action "Remounting root filesystem in read-write mode" mount -n -o remount,rw /
+ln -s /tmp/stage2/etc/* . 2>/dev/null
+
+mkdir /proc
+action "Mounting proc filesystem" mount -n -t proc /proc /proc
+
>/etc/mtab
mount -f /
mount -f /proc
diff --git a/rescue/tree/usr/share/symlinks b/rescue/tree/usr/share/symlinks
new file mode 100644
index 000000000..421b70d7b
--- /dev/null
+++ b/rescue/tree/usr/share/symlinks
@@ -0,0 +1,10 @@
+/bin
+/boot
+/dev
+/etc/fstab
+/etc/inittab
+/etc/rc.sysinit
+/lib
+/modules
+/sbin
+/usr