diff options
Diffstat (limited to 'mdk-stage1/tools.c')
-rw-r--r-- | mdk-stage1/tools.c | 73 |
1 files changed, 68 insertions, 5 deletions
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c index 59d4a1ddf..ef7d10d6f 100644 --- a/mdk-stage1/tools.c +++ b/mdk-stage1/tools.c @@ -91,9 +91,10 @@ void process_cmdline(void) params[param_number].name = name; params[param_number].value = value; param_number++; - if (!strcmp(name, "expert")) set_param(MODE_EXPERT); + if (!strcmp(name, "expert")) set_param(MODE_THIRDPARTY); if (!strcmp(name, "changedisk")) set_param(MODE_CHANGEDISK); - if (!strcmp(name, "updatemodules")) set_param(MODE_UPDATEMODULES); + if (!strcmp(name, "updatemodules") || + !strcmp(name, "thirdparty")) set_param(MODE_THIRDPARTY); if (!strcmp(name, "rescue")) set_param(MODE_RESCUE); if (!strcmp(name, "noauto")) set_param(MODE_NOAUTO); if (!strcmp(name, "netauto")) set_param(MODE_NETAUTO); @@ -108,7 +109,11 @@ void process_cmdline(void) break; i++; } - + + if (IS_AUTOMATIC && strcmp(get_auto_value("thirdparty"), "")) { + set_param(MODE_THIRDPARTY); + } + log_message("\tgot %d args", param_number); } @@ -135,13 +140,13 @@ int get_param(int i) buf[nb] = '\0'; ptr = buf; while ((ptr = strstr(ptr, "+ "))) { - if (!strncmp(ptr+2, "expert", 6)) set_param(MODE_EXPERT); + if (!strncmp(ptr+2, "expert", 6)) set_param(MODE_THIRDPARTY); if (!strncmp(ptr+2, "rescue", 6)) set_param(MODE_RESCUE); ptr++; } ptr = buf; while ((ptr = strstr(ptr, "- "))) { - if (!strncmp(ptr+2, "expert", 6)) unset_param(MODE_EXPERT); + if (!strncmp(ptr+2, "expert", 6)) unset_param(MODE_THIRDPARTY); if (!strncmp(ptr+2, "rescue", 6)) unset_param(MODE_RESCUE); ptr++; } @@ -478,7 +483,65 @@ int kernel_version(void) return -1; } return charstar_to_int(val.release + 2); + +} + +int try_mount(char * dev, char * location) +{ + char device_fullname[50]; + strcpy(device_fullname, "/dev/"); + strcat(device_fullname, dev); + + if (my_mount(device_fullname, location, "ext2", 0) == -1 && + my_mount(device_fullname, location, "vfat", 0) == -1 && + my_mount(device_fullname, location, "reiserfs", 0) == -1 && + my_mount(device_fullname, location, "iso9660", 0) == -1) { + return 1; + } + + return 0; +} + +#ifndef DISABLE_DISK +int get_disks(char *** names, char *** models) +{ + char ** ptr; + int count = 0; + + my_insmod("sd_mod", ANY_DRIVER_TYPE, NULL, 0); + + get_medias(DISK, names, models, BUS_ANY); + + ptr = *names; + while (ptr && *ptr) { + count++; + ptr++; + } + + return count; +} +#endif + +#ifndef DISABLE_CDROM +int get_cdroms(char *** names, char *** models) +{ + char ** ptr; + int count = 0; + + my_insmod("ide-cd", ANY_DRIVER_TYPE, NULL, 0); + my_insmod("sr_mod", ANY_DRIVER_TYPE, NULL, 0); + + get_medias(CDROM, names, models, BUS_ANY); + + ptr = *names; + while (ptr && *ptr) { + count++; + ptr++; + } + + return count; } +#endif char * floppy_device(void) { |