summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/stage1.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-10-18 22:32:49 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-10-18 22:32:49 +0000
commit673ead66567478de006650e4a502b81d08652b4c (patch)
treed14a422e076b46e78c26baac44042c9cd295c070 /mdk-stage1/stage1.c
parentca4dfa2f982141d9eaed450c9c3852cd9ec4e24c (diff)
downloaddrakx-backup-do-not-use-673ead66567478de006650e4a502b81d08652b4c.tar
drakx-backup-do-not-use-673ead66567478de006650e4a502b81d08652b4c.tar.gz
drakx-backup-do-not-use-673ead66567478de006650e4a502b81d08652b4c.tar.bz2
drakx-backup-do-not-use-673ead66567478de006650e4a502b81d08652b4c.tar.xz
drakx-backup-do-not-use-673ead66567478de006650e4a502b81d08652b4c.zip
support cloop over NFS too. stay flexible enough so that server= parameter can either designate the root of the live tree or the root for the cloop live tree, program will detect automatically both.
Diffstat (limited to 'mdk-stage1/stage1.c')
-rw-r--r--mdk-stage1/stage1.c26
1 files changed, 26 insertions, 0 deletions
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"))