diff options
-rw-r--r-- | mdk-stage1/NEWS | 3 | ||||
-rw-r--r-- | mdk-stage1/cdrom.c | 4 | ||||
-rw-r--r-- | mdk-stage1/directory.c | 5 | ||||
-rw-r--r-- | mdk-stage1/tools.c | 20 | ||||
-rw-r--r-- | mdk-stage1/tools.h | 1 |
5 files changed, 28 insertions, 5 deletions
diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS index 2623ea9cc..59396a3bc 100644 --- a/mdk-stage1/NEWS +++ b/mdk-stage1/NEWS @@ -1,3 +1,6 @@ +- if you give nfs directory xxx, try to use xxx/ARCH +- handle cdroms with and without ARCH at the root + 1.15: - ask loading modules from /modules if needed - read modules description from /modules/modules.description diff --git a/mdk-stage1/cdrom.c b/mdk-stage1/cdrom.c index 65220c597..89e5ef8dd 100644 --- a/mdk-stage1/cdrom.c +++ b/mdk-stage1/cdrom.c @@ -44,7 +44,9 @@ static int mount_that_cd_device(char * dev_name) snprintf(device_fullname, sizeof(device_fullname), "/dev/%s", dev_name); mount_result = my_mount(device_fullname, MEDIA_LOCATION, "iso9660", 0); - symlink(MEDIA_LOCATION_REL "/" ARCH, IMAGE_LOCATION); + + create_IMAGE_LOCATION(MEDIA_LOCATION); + return mount_result; } diff --git a/mdk-stage1/directory.c b/mdk-stage1/directory.c index 3c644f379..21d9fc1a1 100644 --- a/mdk-stage1/directory.c +++ b/mdk-stage1/directory.c @@ -141,10 +141,7 @@ enum return_type try_with_directory(char *directory, char *method_live, char *me add_to_env("ISOPATH", location_full); add_to_env("METHOD", method_iso); } else { - int offset = strncmp(location_full, IMAGE_LOCATION_DIR, sizeof(IMAGE_LOCATION_DIR) - 1) == 0 ? sizeof(IMAGE_LOCATION_DIR) - 1 : 0; - log_message("assuming %s is a mirror tree", location_full + offset); - - symlink(location_full + offset, IMAGE_LOCATION); + create_IMAGE_LOCATION(location_full); add_to_env("METHOD", method_live); } diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c index 2909d2e60..6a024eedd 100644 --- a/mdk-stage1/tools.c +++ b/mdk-stage1/tools.c @@ -53,6 +53,26 @@ int image_has_stage2() access(IMAGE_LOCATION "/" LIVE_LOCATION_REL, R_OK) == 0; } +enum return_type create_IMAGE_LOCATION(char *location_full) +{ + struct stat statbuf; + int offset = strncmp(location_full, IMAGE_LOCATION_DIR, sizeof(IMAGE_LOCATION_DIR) - 1) == 0 ? sizeof(IMAGE_LOCATION_DIR) - 1 : 0; + char *with_arch = asprintf_("%s/%s", location_full, ARCH); + + log_message("trying %s", with_arch); + + if (stat(with_arch, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) + location_full = with_arch; + + log_message("assuming %s is a mirror tree", location_full + offset); + + unlink(IMAGE_LOCATION); + if (symlink(location_full + offset, IMAGE_LOCATION) != 0) + return RETURN_ERROR; + + return RETURN_OK; +} + int ramdisk_possible(void) { if (total_memory() > (IS_RESCUE ? MEM_LIMIT_RESCUE : MEM_LIMIT_DRAKX)) diff --git a/mdk-stage1/tools.h b/mdk-stage1/tools.h index f8d9d4ee9..85ff42196 100644 --- a/mdk-stage1/tools.h +++ b/mdk-stage1/tools.h @@ -27,6 +27,7 @@ #include "bootsplash.h" int image_has_stage2(); +enum return_type create_IMAGE_LOCATION(char *location_full); int ramdisk_possible(void); enum return_type copy_file(char * from, char * to, void (*callback_func)(int overall)); enum return_type recursiveRemove(char *file); |