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] = {
- { "nl", "Dutch (Nederlands)" },
- { "en", "English" },
- { "fr", "French (Français)" },
- { "de", "German (Deutsch)" },
- { "pl", "Polish (Polski)" },
- { "ru", "Russian (Русский)" },
- { "es", "Spanish (Español)" },
- { "tr", "Turkish (Türkçe)" },
+ { "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)" },
{ NULL, NULL },
};
char* roottext = center_string(system_release, screen_cols);
newtDrawRootText(0, 0, roottext);
- sprintf (title, "%s %s - %s", NAME, VERSION, SLOGAN);
+ snprintf(title, sizeof(title), "%s - %s", NAME, SLOGAN);
if (! (cmdfile = fopen("/proc/cmdline", "r")))
{
assert(choice <= NUM_LANGS);
fprintf(flog, "Selected language: %s (%s)\n", languages[choice].name, languages[choice].code);
+
+ setenv("LANGUAGE", languages[choice].code, 1);
setlocale(LC_ALL, languages[choice].code);
}
if (!unattended) {
snprintf(message, sizeof(message),
- _("Welcome to the %s installation program. "
+ _("Welcome to the %s installation program.\n\n"
"Selecting Cancel on any of the following screens will reboot the computer."), NAME);
newtWinMessage(title, _("Start installation"), message);
}
fread(discl_msg, 1, 40000, copying);
fclose(copying);
- if (newtLicenseBox(title, discl_msg, 75, 20)) {
+ if (newtLicenseBox(_("License Agreement"), discl_msg, 75, 20)) {
errorbox(_("License not accepted!"));
goto EXIT;
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;
} 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."));
+ fprintf(flog, "Num disks selected: %d\n", num_selected_disks);
}
if (selected_disks) {
// Warn the user if there is not enough space to create a swap partition
if (!unattended && !*destination->part_swap) {
rc = newtWinChoice(title, _("OK"), _("Cancel"),
- _("Your harddisk is very small, but you can continue with an very small swap. (Use with caution)."));
+ _("Your harddisk is very small, but you can continue without a swap partition."));
if (rc != 1)
goto EXIT;
}
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...
// 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 console\"\n");
+ fprintf(f, "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=%d\"\n", SERIAL_BAUDRATE);
+ fclose(f);
+
+ replace(DESTINATION_MOUNT_PATH "/etc/default/grub", "panic=10", "panic=10 console=ttyS0,115200n8");
- /*inittab*/
+ /* 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");
mysystem(logfile, commandstring);
}
+ // Umount the destination drive
+ hw_umount_filesystems(destination, DESTINATION_MOUNT_PATH);
+
+ // Stop the RAID array if we are using RAID
+ if (destination->is_raid)
+ hw_stop_all_raid_arrays(logfile);
+
// Umount source drive and eject
hw_umount(SOURCE_MOUNT_PATH);
mysystem(logfile, commandstring);
if (!unattended) {
- snprintf(message, sizeof(message), _("%s was successfully installed. "
- "Please remove any installation mediums from this system. "
- "Setup will now run where you may configure networking and the system passwords. "
- "After Setup has been completed, you should point your web browser at https://%s:444 "
- "(or whatever you name your %s), and configure dialup networking (if required) and "
- "remote access."), NAME, SNAME, NAME);
+ snprintf(message, sizeof(message), _(
+ "%s was successfully installed!\n\n"
+ "Please remove any installation mediums from this system and hit the reboot button. "
+ "Once the system has restarted you will be asked to setup networking and system passwords. "
+ "After that, you should point your web browser at https://%s:444 (or what ever you name "
+ "your %s) for the web configuration console."), NAME, SNAME, NAME);
newtWinMessage(_("Congratulations!"), _("Reboot"), message);
}
EXIT:
fprintf(flog, "Install program ended.\n");
+ fflush(flog);
+ fclose(flog);
- if (!(allok))
- newtWinMessage(title, _("OK"), _("Press Ok to reboot."));
-
- if (allok) {
- fflush(flog);
- fclose(flog);
- }
+ if (!allok)
+ newtWinMessage(title, _("OK"), _("Setup has failed. Press Ok to reboot."));
newtFinished();
free(helpline);
free(sourcedrive);
-
- if (destination) {
- hw_sync();
-
- hw_umount_filesystems(destination, DESTINATION_MOUNT_PATH);
- free(destination);
- }
+ free(destination);
hw_stop_all_raid_arrays(logfile);