summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdk-stage1/NEWS1
-rw-r--r--mdk-stage1/disk.c27
2 files changed, 23 insertions, 5 deletions
diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS
index 5cfc473c4..3a494a2b9 100644
--- a/mdk-stage1/NEWS
+++ b/mdk-stage1/NEWS
@@ -1,5 +1,6 @@
- advertize "ext4" rather than "ext2"
- check for builtin modules in /sys/fs too (eg: ext4)
+- support auto-install with "method:disk,disk:xxx,part:xxxY,dir:zzz"
2.32
diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c
index e7c38e27d..51a033639 100644
--- a/mdk-stage1/disk.c
+++ b/mdk-stage1/disk.c
@@ -45,6 +45,13 @@
static enum return_type try_automatic_with_partition(char *dev) {
enum return_type results;
int mounted;
+ char *dir= get_auto_value("directory");
+ char location_full[500];
+ strcpy(location_full, MEDIA_LOCATION);
+ if (dir) {
+ strcat(location_full, "/");
+ strcat(location_full, dir);
+ }
wait_message("Trying to access " DISTRIB_NAME " disk (partition %s)", dev);
mounted = !try_mount(dev, MEDIA_LOCATION);
remove_wait_message();
@@ -52,11 +59,13 @@ static enum return_type try_automatic_with_partition(char *dev) {
create_IMAGE_LOCATION(MEDIA_LOCATION);
if (image_has_stage2()) {
results = try_with_directory(MEDIA_LOCATION, "disk", "disk-iso");
- if (results == RETURN_OK) {
- if (!KEEP_MOUNTED)
- umount(MEDIA_LOCATION);
- return RETURN_OK;
- }
+ } else {
+ results = try_with_directory(location_full, "disk", "disk-iso");
+ }
+ if (results == RETURN_OK) {
+ if (!KEEP_MOUNTED)
+ umount(MEDIA_LOCATION);
+ return RETURN_OK;
}
}
if (mounted)
@@ -69,6 +78,7 @@ static enum return_type try_automatic_with_disk(char *disk, char *model) {
char * parts_comments[50];
enum return_type results;
char **dev;
+ char *part = get_auto_value("partition");
wait_message("Trying to access " DISTRIB_NAME " disk (drive %s)", model);
if (list_partitions(disk, parts, parts_comments)) {
stg1_error_message("Could not read partitions information.");
@@ -77,10 +87,13 @@ static enum return_type try_automatic_with_disk(char *disk, char *model) {
remove_wait_message();
dev = parts;
while (dev && *dev) {
+ if (part && strcmp(part, *dev) != 0)
+ goto next;
results = try_automatic_with_partition(*dev);
if (results == RETURN_OK) {
return RETURN_OK;
}
+ next:
dev++;
}
return RETURN_ERROR;
@@ -90,11 +103,15 @@ static enum return_type try_automatic(char ** medias, char ** medias_models)
{
char ** model = medias_models;
char ** ptr = medias;
+ char *disk = get_auto_value("disk");
while (ptr && *ptr) {
enum return_type results;
+ if (disk && strcmp(disk, *ptr) != 0)
+ goto next;
results = try_automatic_with_disk(*ptr, *model);
if (results == RETURN_OK)
return RETURN_OK;
+ next:
ptr++;
model++;
}