summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2018-11-30 02:39:01 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2018-11-30 02:49:58 +0100
commit649d020e22e77f6e5253bccf5e9b4d60e2bee6ce (patch)
tree0ea526ffbb092c19917142136b1c4c393ef643ed /mdk-stage1
parent8cf163db4ff9bc61334cd0c3ed53fabe13dd2587 (diff)
downloaddrakx-649d020e22e77f6e5253bccf5e9b4d60e2bee6ce.tar
drakx-649d020e22e77f6e5253bccf5e9b4d60e2bee6ce.tar.gz
drakx-649d020e22e77f6e5253bccf5e9b4d60e2bee6ce.tar.bz2
drakx-649d020e22e77f6e5253bccf5e9b4d60e2bee6ce.tar.xz
drakx-649d020e22e77f6e5253bccf5e9b4d60e2bee6ce.zip
add support for disk-iso auto-install
eg: "method:disk,disk:vdb,partition:vdb1,dir:/Mageia/boot.iso" in the future, we might want to merge back !automatic & automatic paths
Diffstat (limited to 'mdk-stage1')
-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++;
}