summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/cdrom.c4
-rw-r--r--mdk-stage1/config-stage1.h1
-rw-r--r--mdk-stage1/network.c2
-rw-r--r--mdk-stage1/stage1.c26
4 files changed, 28 insertions, 5 deletions
diff --git a/mdk-stage1/cdrom.c b/mdk-stage1/cdrom.c
index 8c136c125..98cea4765 100644
--- a/mdk-stage1/cdrom.c
+++ b/mdk-stage1/cdrom.c
@@ -73,10 +73,6 @@ static enum return_type do_with_device(char * dev_name, char * dev_model)
#ifndef MANDRAKE_MOVE
if (IS_SPECIAL_STAGE2 || ramdisk_possible())
load_ramdisk(); /* we don't care about return code, we'll do it live if we failed */
-#else
- my_insmod("cloop", ANY_DRIVER_TYPE, "file=" IMAGE_LOCATION "/live_tree.clp");
- if (my_mount("/dev/cloop0", IMAGE_LOCATION_REAL, "iso9660", 0))
- stg1_error_message("Could not mount compressed loopback :(.");
#endif
if (IS_RESCUE)
diff --git a/mdk-stage1/config-stage1.h b/mdk-stage1/config-stage1.h
index c4b065bd3..57041bfa5 100644
--- a/mdk-stage1/config-stage1.h
+++ b/mdk-stage1/config-stage1.h
@@ -36,6 +36,7 @@
#define IMAGE_LOCATION "/sysroot/image_raw"
#define IMAGE_LOCATION_REAL "/sysroot/image"
#define SLASH_LOCATION "/sysroot"
+#define RAW_LOCATION_REL "/image_raw"
#define LIVE_LOCATION_REL "/image"
#else
#define DISTRIB_NAME "Mandrake Linux"
diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c
index 84baba81e..f6834c55b 100644
--- a/mdk-stage1/network.c
+++ b/mdk-stage1/network.c
@@ -661,7 +661,7 @@ enum return_type nfs_prepare(void)
}
#ifdef MANDRAKE_MOVE
- if (access(IMAGE_LOCATION "/usr/bin/runstage2", R_OK)) {
+ if (access(IMAGE_LOCATION "/usr/bin/runstage2", R_OK) && access(IMAGE_LOCATION "/live_tree.clp", R_OK)) {
#else
if (access(IMAGE_LOCATION LIVE_LOCATION, R_OK)) {
#endif
diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c
index e85802995..829d85514 100644
--- a/mdk-stage1/stage1.c
+++ b/mdk-stage1/stage1.c
@@ -393,6 +393,25 @@ int mandrake_move_post(void)
char buf[5000];
int fd;
char rootdev[] = "0x0100";
+ int real_is_symlink_to_raw = 0;
+
+ if (!access(IMAGE_LOCATION "/move/symlinks", R_OK)) {
+ log_message("move: seems we don't use a cloop since " IMAGE_LOCATION "/move/symlinks is here");
+ if (scall(symlink(IMAGE_LOCATION, IMAGE_LOCATION_REAL), "symlink"))
+ return RETURN_ERROR;
+ real_is_symlink_to_raw = 1;
+ } else {
+ if (access(IMAGE_LOCATION "/live_tree.clp", R_OK)) {
+ log_message("move: panic, " IMAGE_LOCATION "/move/symlinks isn't here but " IMAGE_LOCATION "/live_tree.clp neither");
+ return RETURN_ERROR;
+ } else {
+ my_insmod("cloop", ANY_DRIVER_TYPE, "file=" IMAGE_LOCATION "/live_tree.clp");
+ if (scall(mknod("/dev/cloop0", S_IFBLK | 0600, makedev(240, 0)), "mknod"))
+ return RETURN_ERROR;
+ if (my_mount("/dev/cloop0", IMAGE_LOCATION_REAL, "iso9660", 0))
+ stg1_error_message("Could not mount compressed loopback :(.");
+ }
+ }
if (scall(!(f = fopen(IMAGE_LOCATION_REAL "/move/symlinks", "rb")), "fopen"))
return RETURN_ERROR;
@@ -424,6 +443,13 @@ int mandrake_move_post(void)
}
fclose(f);
+ if (real_is_symlink_to_raw) {
+ if (scall(unlink(IMAGE_LOCATION_REAL), "unlink"))
+ return RETURN_ERROR;
+ if (scall(symlink(RAW_LOCATION_REL, IMAGE_LOCATION_REAL), "symlink"))
+ return RETURN_ERROR;
+ }
+
log_message("move: pivot_rooting");
// trick so that kernel won't try to mount the root device when initrd exits
if (scall((fd = open("/proc/sys/kernel/real-root-dev", O_WRONLY)) < 0, "open"))