]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/installer/main.c
installer: Enable new partitioning code to be run in unattended mode
[ipfire-2.x.git] / src / installer / main.c
index d9dd75c2c63055870e58db5c90a044560551b12c..f197dc351c39a054ba1099717856769d9af4d6cc 100644 (file)
@@ -281,17 +281,16 @@ int main(int argc, char *argv[]) {
 
        snprintf(title, sizeof(title), "%s - %s", NAME, SLOGAN);
 
-       if (! (cmdfile = fopen("/proc/cmdline", "r")))
-       {
+       if (! (cmdfile = fopen("/proc/cmdline", "r"))) {
                fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
        } else {
                fgets(line, STRING_SIZE, cmdfile);
-               
+
                // check if we have to make an unattended install
-               if (strstr (line, "unattended") != NULL) {
+               if (strstr(line, "installer.unattended") != NULL) {
+                   splashWindow(title, _("Warning: Unattended installation will start in 10 seconds..."), 10);
                    unattended = 1;
-                   runcommandwithstatus("/bin/sleep 10", title, "WARNING: Unattended installation will start in 10 seconds...", NULL);
-               }               
+               }
                // check if we have to patch for serial console
                if (strstr (line, "console=ttyS0") != NULL) {
                    serialconsole = 1;
@@ -314,7 +313,7 @@ int main(int argc, char *argv[]) {
                }
                langnames[NUM_LANGS] = NULL;
 
-           rc = newtWinMenu(_("Language selection"), _("Select the language you wish to use for the installation."),
+               rc = newtWinMenu(_("Language selection"), _("Select the language you wish to use for the installation."),
                        50, 5, 5, 8, langnames, &choice, _("OK"), NULL);
 
                assert(choice <= NUM_LANGS);
@@ -406,8 +405,10 @@ int main(int argc, char *argv[]) {
                        goto EXIT;
 
                // exactly one disk has been found
-               } else if (num_disks == 1) {
-                       selected_disks = hw_select_disks(disks, NULL);
+               // or if we are running in unattended mode, we will select
+               // the first disk and go with that one
+               } else if ((num_disks == 1) || (unattended && num_disks >= 1)) {
+                       selected_disks = hw_select_first_disk(disks);
 
                // more than one usable disk has been found and
                // the user needs to choose what to do with them
@@ -442,6 +443,11 @@ int main(int argc, char *argv[]) {
                        }
                }
 
+               // Don't print the auto-selected harddisk setup in
+               // unattended mode.
+               if (unattended)
+                       break;
+
                num_selected_disks = hw_count_disks(selected_disks);
 
                if (num_selected_disks == 1) {
@@ -469,7 +475,7 @@ int main(int argc, char *argv[]) {
 
                // Currently not supported
                } else {
-                       errorbox(_("You disk configuration is currently not supported."));
+                       errorbox(_("Your disk configuration is currently not supported."));
                        fprintf(flog, "Num disks selected: %d\n", num_selected_disks);
                }
 
@@ -494,6 +500,7 @@ int main(int argc, char *argv[]) {
        fprintf(flog, "  swap   : %s (%lluMB)\n", destination->part_swap, BYTES2MB(destination->size_swap));
        fprintf(flog, "  root   : %s (%lluMB)\n", destination->part_root, BYTES2MB(destination->size_root));
        fprintf(flog, "  data   : %s (%lluMB)\n", destination->part_data, BYTES2MB(destination->size_data));
+       fprintf(flog, "Memory   : %lluMB\n", BYTES2MB(hw_memory()));
 
        // Warn the user if there is not enough space to create a swap partition
        if (!unattended && !*destination->part_swap) {
@@ -620,7 +627,7 @@ int main(int argc, char *argv[]) {
                        goto EXIT;
                }
 
-               fprintf(f, "GRUB_TERMINAL=\"serial console\"\n");
+               fprintf(f, "GRUB_TERMINAL=\"serial\"\n");
                fprintf(f, "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=%d\"\n", SERIAL_BAUDRATE);
                fclose(f);