newtTextboxSetText(textbox, message);
newtFormAddComponent(form, textbox);
- newtComponent btn_ok = newtButton((width - 16) / 3, height - 4, btn_txt_ok);
- newtComponent btn_cancel = newtButton((width - 16) / 3 * 2 + 9, height - 4,
+ unsigned int btn_width_ok = strlen(btn_txt_ok);
+ unsigned int btn_width_cancel = strlen(btn_txt_cancel);
+
+ newtComponent btn_ok = newtButton((width / 3) - (btn_width_ok / 2) - 2, height - 4, btn_txt_ok);
+ newtComponent btn_cancel = newtButton((width * 2 / 3) - (btn_width_cancel / 2) - 2, height - 4,
btn_txt_cancel);
newtFormAddComponents(form, btn_ok, btn_cancel, NULL);
const char* code;
char* name;
} languages[NUM_LANGS + 1] = {
+ { "da.utf8", "Danish (Dansk)" },
{ "nl_NL.utf8", "Dutch (Nederlands)" },
{ "en_US.utf8", "English" },
{ "fr_FR.utf8", "French (Français)" },
{ "de_DE.utf8", "German (Deutsch)" },
{ "pl_PL.utf8", "Polish (Polski)" },
+ { "pt_BR.utf8", "Portuguese (Brasil)" },
{ "ru_RU.utf8", "Russian (Русский)" },
{ "es_ES.utf8", "Spanish (Español)" },
{ "tr_TR.utf8", "Turkish (Türkçe)" },
int rc = 0;
char commandstring[STRING_SIZE];
int choice;
- char shortlangname[10];
+ char language[STRING_SIZE];
char message[STRING_SIZE];
char title[STRING_SIZE];
int allok = 0;
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;
}
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);
fprintf(flog, "Selected language: %s (%s)\n", languages[choice].name, languages[choice].code);
+ snprintf(language, sizeof(language), languages[choice].code);
- setenv("LANGUAGE", languages[choice].code, 1);
- setlocale(LC_ALL, languages[choice].code);
+ setenv("LANGUAGE", language, 1);
+ setlocale(LC_ALL, language);
}
char* helpline = center_string(_("<Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen"), screen_cols);
int part_type = HW_PART_TYPE_NORMAL;
// Scan for disks to install on.
- struct hw_disk** disks = hw_find_disks(hw);
+ struct hw_disk** disks = hw_find_disks(hw, sourcedrive);
struct hw_disk** selected_disks = NULL;
unsigned int num_selected_disks = 0;
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
}
}
+ // 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) {
} else if (num_selected_disks == 2) {
snprintf(message, sizeof(message),
_("The installation program will now set up a RAID configuration on the selected harddisks:\n\n %s\n %s\n\n"
- "Do you agree to continue?"), (*selected_disks)->description, (*selected_disks + 1)->description);
+ "Do you agree to continue?"), selected_disks[0]->description, selected_disks[1]->description);
rc = newtWinOkCancel(_("RAID Setup"), message, 50, 14,
_("Delete all data"), _("Cancel"));
// 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);
}
if (selected_disks) {
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) {
}
newtPopWindow();
+ } else {
+ // We will have to destroy all RAID setups that may have
+ // been on the devices that we want to use now.
+ hw_destroy_raid_superblocks(destination, logfile);
}
// Execute the partitioning...
}
/* Save language und local settings */
- write_lang_configs(shortlangname);
+ write_lang_configs(language);
/* Build cache lang file */
snprintf(commandstring, STRING_SIZE, "/usr/sbin/chroot /harddisk /usr/bin/perl -e \"require '" CONFIG_ROOT "/lang.pl'; &Lang::BuildCacheLang\"");
// Installing bootloader...
statuswindow(60, 4, title, _("Installing the bootloader..."));
- rc = hw_install_bootloader(destination, logfile);
- if (rc) {
- errorbox(_("Unable to install the bootloader."));
- goto EXIT;
- }
-
- newtPopWindow();
-
/* Serial console ? */
if (serialconsole) {
/* grub */
- replace("/harddisk/boot/grub/grub.conf", "splashimage", "#splashimage");
- replace("/harddisk/boot/grub/grub.conf", "#serial", "serial");
- replace("/harddisk/boot/grub/grub.conf", "#terminal", "terminal");
- replace("/harddisk/boot/grub/grub.conf", " panic=10 ", " console=ttyS0,115200n8 panic=10 ");
+ FILE* f = fopen(DESTINATION_MOUNT_PATH "/etc/default/grub", "a");
+ if (!f) {
+ errorbox(_("Unable to open /etc/default/grub for writing."));
+ goto EXIT;
+ }
+
+ fprintf(f, "GRUB_TERMINAL=\"serial\"\n");
+ fprintf(f, "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=%d\"\n", SERIAL_BAUDRATE);
+ fclose(f);
- /*inittab*/
+ replace(DESTINATION_MOUNT_PATH "/etc/default/grub", "panic=10", "panic=10 console=ttyS0,115200n8");
+
+ /* inittab */
replace("/harddisk/etc/inittab", "1:2345:respawn:", "#1:2345:respawn:");
replace("/harddisk/etc/inittab", "2:2345:respawn:", "#2:2345:respawn:");
replace("/harddisk/etc/inittab", "3:2345:respawn:", "#3:2345:respawn:");
replace("/harddisk/etc/inittab", "#7:2345:respawn:", "7:2345:respawn:");
}
+ rc = hw_install_bootloader(destination, logfile);
+ if (rc) {
+ errorbox(_("Unable to install the bootloader."));
+ goto EXIT;
+ }
+
+ newtPopWindow();
+
/* Set marker that the user has already accepted the gpl */
mysystem(logfile, "/usr/bin/touch /harddisk/var/ipfire/main/gpl_accepted");