summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/tools.c
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-05 13:27:02 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-05 13:27:02 +0000
commitb25b64e526e281cd04719d8f0765b445241117e5 (patch)
tree76810b02f32ba634c2ba712fedd9491c1e20b4d3 /mdk-stage1/tools.c
parentf3985ec83c291a8fd09d1147219a5c67905783fc (diff)
downloaddrakx-b25b64e526e281cd04719d8f0765b445241117e5.tar
drakx-b25b64e526e281cd04719d8f0765b445241117e5.tar.gz
drakx-b25b64e526e281cd04719d8f0765b445241117e5.tar.bz2
drakx-b25b64e526e281cd04719d8f0765b445241117e5.tar.xz
drakx-b25b64e526e281cd04719d8f0765b445241117e5.zip
- if you give nfs directory xxx, try to use xxx/ARCH
- handle cdroms with and without ARCH at the root and factorize the code into create_IMAGE_LOCATION()
Diffstat (limited to 'mdk-stage1/tools.c')
-rw-r--r--mdk-stage1/tools.c20
1 files changed, 20 insertions, 0 deletions
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))