]> git.ipfire.org Git - ipfire-2.x.git/blame - src/installer/main.c
Move installer to its own directory.
[ipfire-2.x.git] / src / installer / main.c
CommitLineData
d6aaa55d
MT
1/* SmoothWall install program.
2 *
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
5 *
6 * (c) Lawrence Manning, 2001
f9cc0d70 7 * Contains main entry point, and misc functions.6
d6aaa55d 8 *
d6aaa55d 9 */
10bc6f06 10
f0fa1795
MT
11#include <assert.h>
12#include <errno.h>
13#include <stdlib.h>
14#include <string.h>
15#include <sys/mount.h>
16
17#include "hw.h"
18#include "install.h"
5315fae6
MT
19
20// Translation
21#include <libintl.h>
22#define _(x) dgettext("installer", x)
23
68561214 24#define INST_FILECOUNT 21000
33634aa8 25#define UNATTENDED_CONF "/cdrom/boot/unattended.conf"
918546e2 26#define LICENSE_FILE "/cdrom/COPYING"
d6aaa55d 27
d6aaa55d
MT
28FILE *flog = NULL;
29char *mylog;
10bc6f06 30
d6aaa55d
MT
31char **ctr;
32
d6aaa55d
MT
33extern char url[STRING_SIZE];
34
d7dd283b
MT
35static int newtChecklist(const char* title, const char* message,
36 unsigned int width, unsigned int height, unsigned int num_entries,
37 const char** entries, int* states) {
38 int ret;
39 const int list_height = 4;
40
41 char cbstates[num_entries];
42
43 for (unsigned int i = 0; i < num_entries; i++) {
44 cbstates[i] = states[i] ? '*' : ' ';
45 }
46
47 newtCenteredWindow(width, height, title);
48
49 newtComponent textbox = newtTextbox(1, 1, width - 2, height - 6 - list_height,
50 NEWT_FLAG_WRAP);
51 newtTextboxSetText(textbox, message);
52
53 int top = newtTextboxGetNumLines(textbox) + 2;
54
55 newtComponent form = newtForm(NULL, NULL, 0);
56
57 newtComponent sb = NULL;
58 if (list_height < num_entries) {
59 sb = newtVerticalScrollbar(
60 width - 4, top + 1, list_height,
61 NEWT_COLORSET_CHECKBOX, NEWT_COLORSET_ACTCHECKBOX);
62
63 newtFormAddComponent(form, sb);
64 }
65
66 newtComponent subform = newtForm(sb, NULL, 0);
67 newtFormSetBackground(subform, NEWT_COLORSET_CHECKBOX);
68
69 newtFormSetHeight(subform, list_height);
70 newtFormSetWidth(subform, width - 10);
71
72 for (unsigned int i = 0; i < num_entries; i++) {
73 newtComponent cb = newtCheckbox(4, top + i, entries[i], cbstates[i],
74 NULL, &cbstates[i]);
75
76 newtFormAddComponent(subform, cb);
77 }
78
79 newtFormAddComponents(form, textbox, subform, NULL);
80
5315fae6
MT
81 newtComponent btn_okay = newtButton((width - 18) / 3, height - 4, _("OK"));
82 newtComponent btn_cancel = newtButton((width - 18) / 3 * 2 + 9, height - 4, _("Cancel"));
d7dd283b
MT
83 newtFormAddComponents(form, btn_okay, btn_cancel, NULL);
84
85 newtComponent answer = newtRunForm(form);
86
87 if ((answer == NULL) || (answer == btn_cancel)) {
88 ret = -1;
89 } else {
90 ret = 0;
91
92 for (unsigned int i = 0; i < num_entries; i++) {
93 states[i] = (cbstates[i] != ' ');
94
95 if (states[i])
96 ret++;
97 }
98 }
99
100 newtFormDestroy(form);
101 newtPopWindow();
102
103 return ret;
104}
105
106static int newtWinOkCancel(const char* title, const char* message, int width, int height,
107 const char* btn_txt_ok, const char* btn_txt_cancel) {
108 int ret = 1;
109
110 newtCenteredWindow(width, height, title);
111
112 newtComponent form = newtForm(NULL, NULL, 0);
113
114 newtComponent textbox = newtTextbox(1, 1, width - 2, height - 6, NEWT_FLAG_WRAP);
115 newtTextboxSetText(textbox, message);
116 newtFormAddComponent(form, textbox);
117
118 newtComponent btn_ok = newtButton((width - 16) / 3, height - 4, btn_txt_ok);
119 newtComponent btn_cancel = newtButton((width - 16) / 3 * 2 + 9, height - 4,
120 btn_txt_cancel);
121
122 newtFormAddComponents(form, btn_ok, btn_cancel, NULL);
123
124 newtComponent answer = newtRunForm(form);
125
126 if (answer == btn_ok) {
127 ret = 0;
128 }
129
130 newtFormDestroy(form);
131 newtPopWindow();
132
133 return ret;
134}
135
bd5e7c29
MT
136static int newtLicenseBox(const char* title, const char* text, int width, int height) {
137 int ret = 1;
138
139 newtCenteredWindow(width, height, title);
140
141 newtComponent form = newtForm(NULL, NULL, 0);
142
143 newtComponent textbox = newtTextbox(1, 1, width - 2, height - 7,
144 NEWT_FLAG_WRAP|NEWT_FLAG_SCROLL);
145 newtTextboxSetText(textbox, text);
146 newtFormAddComponent(form, textbox);
147
148 char choice;
5315fae6 149 newtComponent checkbox = newtCheckbox(3, height - 3, _("I accept this license"),
bd5e7c29
MT
150 ' ', " *", &choice);
151
5315fae6 152 newtComponent btn = newtButton(width - 15, height - 4, _("OK"));
bd5e7c29
MT
153
154 newtFormAddComponents(form, checkbox, btn, NULL);
155
156 newtComponent answer = newtRunForm(form);
157 if (answer == btn && choice == '*')
158 ret = 0;
159
160 newtFormDestroy(form);
161 newtPopWindow();
162
163 return ret;
164}
165
5315fae6
MT
166int write_lang_configs(const char *lang) {
167 struct keyvalue *kv = initkeyvalues();
168
169 /* default stuff for main/settings. */
170 replacekeyvalue(kv, "LANGUAGE", lang);
171 replacekeyvalue(kv, "HOSTNAME", SNAME);
172 replacekeyvalue(kv, "THEME", "ipfire");
173 writekeyvalues(kv, "/harddisk" CONFIG_ROOT "/main/settings");
174 freekeyvalues(kv);
175
176 return 1;
177}
178
f0fa1795
MT
179int main(int argc, char *argv[]) {
180 struct hw* hw = hw_init();
e0bbaf87
AF
181
182 char discl_msg[40000] = "Disclaimer\n";
183
910193da
EY
184 char *langnames[] = { "Deutsch", "English", "Français", "Español", "Nederlands", "Polski", "Русский", "Türkçe", NULL };
185 char *shortlangnames[] = { "de", "en", "fr", "es", "nl", "pl", "ru", "tr", NULL };
f0fa1795 186 char* sourcedrive = NULL;
72d80898 187 int rc = 0;
d6aaa55d 188 char commandstring[STRING_SIZE];
d6aaa55d
MT
189 int choice;
190 char shortlangname[10];
d7dd283b 191 char message[STRING_SIZE];
d6aaa55d
MT
192 char title[STRING_SIZE];
193 int allok = 0;
e0bbaf87 194 FILE *handle, *cmdfile, *copying;
d6aaa55d 195 char line[STRING_SIZE];
5057b611 196
72d80898 197 int unattended = 0;
5faa66cf 198 int serialconsole = 0;
72d80898 199 struct keyvalue *unattendedkv = initkeyvalues();
66335974 200 char restore_file[STRING_SIZE] = "";
d6aaa55d
MT
201
202 setlocale (LC_ALL, "");
10bc6f06 203 sethostname( SNAME , 10);
72d80898 204
d6aaa55d
MT
205 /* Log file/terminal stuff. */
206 if (argc >= 2)
207 {
208 if (!(flog = fopen(argv[1], "w+")))
209 return 0;
210 }
211 else
212 return 0;
213
214 mylog = argv[1];
215
216 fprintf(flog, "Install program started.\n");
217
218 newtInit();
219 newtCls();
220
7ea444c8
AF
221 newtDrawRootText(14, 0, NAME " " VERSION " - " SLOGAN );
222 sprintf (title, "%s %s - %s", NAME, VERSION, SLOGAN);
223
d6aaa55d
MT
224 if (! (cmdfile = fopen("/proc/cmdline", "r")))
225 {
226 fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
227 } else {
228 fgets(line, STRING_SIZE, cmdfile);
61e3d218 229
72d80898 230 // check if we have to make an unattended install
ee78a5ef 231 if (strstr (line, "unattended") != NULL) {
72d80898 232 unattended = 1;
5315fae6 233 runcommandwithstatus("/bin/sleep 10", title, "WARNING: Unattended installation will start in 10 seconds...");
bba7212c 234 }
5faa66cf
AF
235 // check if we have to patch for serial console
236 if (strstr (line, "console=ttyS0") != NULL) {
237 serialconsole = 1;
238 }
d6aaa55d 239 }
0db33b56 240
7ea444c8 241 // Load common modules
bba7212c 242 mysystem("/sbin/modprobe vfat"); // USB key
4a0d9bef
MT
243 hw_stop_all_raid_arrays();
244
72d80898 245 /* German is the default */
d6aaa55d
MT
246 for (choice = 0; langnames[choice]; choice++)
247 {
215bd18d 248 if (strcmp(langnames[choice], "English") == 0)
d6aaa55d
MT
249 break;
250 }
251 if (!langnames[choice])
252 goto EXIT;
253
72d80898 254 if (!unattended) {
51f3b7f5 255 rc = newtWinMenu("Language selection", "Select the language you wish to use for the " NAME ".", 50, 5, 5, 8,
72d80898
MT
256 langnames, &choice, "Ok", NULL);
257 }
258
5315fae6 259 setlocale(LC_ALL, shortlangnames[choice]);
3d6e1202 260
5315fae6 261 newtPushHelpLine(_("<Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen"));
0db33b56 262
e0bbaf87 263 if (!unattended) {
5315fae6
MT
264 snprintf(message, sizeof(message),
265 _("Welcome to the %s installation program. "
266 "Selecting Cancel on any of the following screens will reboot the computer."), NAME);
267 newtWinMessage(title, _("Start installation"), message);
e0bbaf87
AF
268 }
269
f0fa1795
MT
270 /* Search for a source drive that holds the right
271 * version of the image we are going to install. */
272 sourcedrive = hw_find_source_medium(hw);
9607771a 273
f0fa1795
MT
274 fprintf(flog, "Source drive: %s\n", sourcedrive);
275 if (!sourcedrive) {
5315fae6
MT
276 newtWinMessage(title, _("OK"), _("No local source media found. Starting download."));
277 runcommandwithstatus("/bin/downloadsource.sh", title, _("Downloading installation image ..."));
0f680bcc 278 if ((handle = fopen("/tmp/source_device", "r")) == NULL) {
5315fae6 279 errorbox(_("Download error"));
0f680bcc
AF
280 goto EXIT;
281 }
f0fa1795
MT
282
283 fgets(sourcedrive, 5, handle);
284 fclose(handle);
72d80898 285 }
0f680bcc 286
f0fa1795
MT
287 assert(sourcedrive);
288
25fcce25 289 int r = hw_mount(sourcedrive, SOURCE_MOUNT_PATH, "iso9660", MS_RDONLY);
f0fa1795
MT
290 if (r) {
291 fprintf(flog, "Could not mount %s to %s\n", sourcedrive, SOURCE_MOUNT_PATH);
292 fprintf(flog, strerror(errno));
293 exit(1);
294 }
918546e2 295
d7dd283b
MT
296 /* load unattended configuration */
297 if (unattended) {
298 fprintf(flog, "unattended: Reading unattended.conf\n");
299
300 (void) readkeyvalues(unattendedkv, UNATTENDED_CONF);
301 findkey(unattendedkv, "RESTORE_FILE", restore_file);
302 }
303
918546e2
MT
304 if (!unattended) {
305 // Read the license file.
306 if (!(copying = fopen(LICENSE_FILE, "r"))) {
307 sprintf(discl_msg, "Could not open license file: %s\n", LICENSE_FILE);
308 fprintf(flog, discl_msg);
309 } else {
310 fread(discl_msg, 1, 40000, copying);
311 fclose(copying);
312
bd5e7c29 313 if (newtLicenseBox(title, discl_msg, 75, 20)) {
5315fae6 314 errorbox(_("License not accepted!"));
bd5e7c29 315
918546e2
MT
316 goto EXIT;
317 }
318 }
319 }
320
d7dd283b 321 int part_type = HW_PART_TYPE_NORMAL;
ee78a5ef 322
d7dd283b
MT
323 // Scan for disks to install on.
324 struct hw_disk** disks = hw_find_disks(hw);
325
326 struct hw_disk** selected_disks = NULL;
327 unsigned int num_selected_disks = 0;
328
329 // Check how many disks have been found and what
330 // we can do with them.
331 unsigned int num_disks = hw_count_disks(disks);
332
333 while (1) {
334 // no harddisks found
335 if (num_disks == 0) {
5315fae6 336 errorbox(_("No hard disk found."));
d7dd283b
MT
337 goto EXIT;
338
339 // exactly one disk has been found
340 } else if (num_disks == 1) {
341 selected_disks = hw_select_disks(disks, NULL);
342
343 // more than one usable disk has been found and
344 // the user needs to choose what to do with them
345 } else {
346 const char* disk_names[num_disks];
347 int disk_selection[num_disks];
348
349 for (unsigned int i = 0; i < num_disks; i++) {
350 disk_names[i] = &disks[i]->description;
351 disk_selection[i] = 0;
352 }
353
354 while (!selected_disks) {
5315fae6
MT
355 rc = newtChecklist(_("Disk Selection"),
356 _("Select the disk(s) you want to install IPFire on. "
357 "First those will be partitioned, and then the partitions will have a filesystem put on them.\n\n"
358 "ALL DATA ON THE DISK WILL BE DESTROYED."),
d7dd283b
MT
359 50, 20, num_disks, disk_names, disk_selection);
360
361 // Error
362 if (rc < 0) {
363 goto EXIT;
364
365 // Nothing has been selected
366 } else if (rc == 0) {
5315fae6
MT
367 errorbox(_("No disk has been selected.\n\n"
368 "Please select one or more disks you want to install IPFire on."));
d7dd283b
MT
369
370 } else {
371 selected_disks = hw_select_disks(disks, disk_selection);
372 }
373 }
374 }
375
376 num_selected_disks = hw_count_disks(selected_disks);
377
378 if (num_selected_disks == 1) {
5315fae6
MT
379 snprintf(message, sizeof(message),
380 _("The installation program will now prepare the chosen harddisk:\n\n %s\n\n"
381 "Do you agree to continue?"), (*selected_disks)->description);
382 rc = newtWinOkCancel(_("Disk Setup"), message, 50, 10,
383 _("Delete all data"), _("Cancel"));
d7dd283b
MT
384
385 if (rc == 0)
56b548f1 386 break;
d7dd283b
MT
387
388 } else if (num_selected_disks == 2) {
5315fae6
MT
389 snprintf(message, sizeof(message),
390 _("The installation program will now set up a RAID configuration on the selected harddisks:\n\n %s\n %s\n\n"
391 "Do you agree to continue?"), (*selected_disks)->description, (*selected_disks + 1)->description);
392 rc = newtWinOkCancel(_("RAID Setup"), message, 50, 14,
393 _("Delete all data"), _("Cancel"));
d7dd283b
MT
394
395 if (rc == 0) {
396 part_type = HW_PART_TYPE_RAID1;
397
ee78a5ef 398 break;
d7dd283b
MT
399 }
400
401 // Currently not supported
402 } else {
5315fae6 403 errorbox(_("You disk configuration is currently not supported."));
aee3027d 404 }
ee78a5ef 405
d7dd283b
MT
406 if (selected_disks) {
407 hw_free_disks(selected_disks);
408 selected_disks = NULL;
409 }
212cab4f 410 }
212cab4f 411
d7dd283b 412 hw_free_disks(disks);
72d80898 413
d7dd283b 414 struct hw_destination* destination = hw_make_destination(part_type, selected_disks);
5057b611 415
25fcce25 416 if (!destination) {
5315fae6 417 errorbox(_("Your harddisk is too small."));
cd8dd8dd 418 goto EXIT;
25fcce25 419 }
cd8dd8dd 420
25fcce25 421 fprintf(flog, "Destination drive: %s\n", destination->path);
48d6a112
MT
422 fprintf(flog, " bootldr: %s (%lluMB)\n", destination->part_bootldr, BYTES2MB(destination->size_bootldr));
423 fprintf(flog, " boot : %s (%lluMB)\n", destination->part_boot, BYTES2MB(destination->size_boot));
424 fprintf(flog, " swap : %s (%lluMB)\n", destination->part_swap, BYTES2MB(destination->size_swap));
425 fprintf(flog, " root : %s (%lluMB)\n", destination->part_root, BYTES2MB(destination->size_root));
426 fprintf(flog, " data : %s (%lluMB)\n", destination->part_data, BYTES2MB(destination->size_data));
72d80898 427
25fcce25
MT
428 // Warn the user if there is not enough space to create a swap partition
429 if (!unattended && !*destination->part_swap) {
5315fae6
MT
430 rc = newtWinChoice(title, _("OK"), _("Cancel"),
431 _("Your harddisk is very small, but you can continue with an very small swap. (Use with caution)."));
4f26ff7f 432
25fcce25
MT
433 if (rc != 1)
434 goto EXIT;
72d80898 435 }
9a3d3d95 436
25fcce25
MT
437 // Filesystem selection
438 if (!unattended) {
439 struct filesystems {
440 int fstype;
441 const char* description;
442 } filesystems[] = {
5315fae6
MT
443 { HW_FS_EXT4, _("ext4 Filesystem") },
444 { HW_FS_EXT4_WO_JOURNAL, _("ext4 Filesystem without journal") },
445 { HW_FS_XFS, _("XFS Filesystem") },
446 { HW_FS_REISERFS, _("ReiserFS Filesystem") },
25fcce25
MT
447 { 0, NULL },
448 };
449 unsigned int num_filesystems = sizeof(filesystems) / sizeof(*filesystems);
450
451 char* fs_names[num_filesystems];
452 int fs_choice = 0;
453 for (unsigned int i = 0; i < num_filesystems; i++) {
454 if (HW_FS_DEFAULT == filesystems[i].fstype)
455 fs_choice = i;
456
457 fs_names[i] = filesystems[i].description;
458 }
72d80898 459
5315fae6
MT
460 rc = newtWinMenu(_("Filesystem Selection"), _("Please choose your filesystem:"),
461 50, 5, 5, 6, fs_names, &fs_choice, _("OK"), _("Cancel"), NULL);
25fcce25
MT
462
463 if (rc == 0)
464 destination->filesystem = filesystems[fs_choice].fstype;
72d80898 465
25fcce25 466 else
72d80898 467 goto EXIT;
72d80898
MT
468 }
469
4a0d9bef
MT
470 // Setting up RAID if needed.
471 if (destination->is_raid) {
5315fae6 472 statuswindow(60, 4, title, _("Building RAID..."));
4a0d9bef
MT
473
474 rc = hw_setup_raid(destination);
475 if (rc) {
5315fae6 476 errorbox(_("Unable to build the RAID."));
4a0d9bef
MT
477 goto EXIT;
478 }
479
480 newtPopWindow();
481 }
482
25fcce25 483 // Execute the partitioning...
5315fae6 484 statuswindow(60, 4, title, _("Partitioning disk..."));
72d80898 485
25fcce25
MT
486 rc = hw_create_partitions(destination);
487 if (rc) {
5315fae6 488 errorbox(_("Unable to partition the disk."));
72d80898 489 goto EXIT;
9607771a 490 }
72d80898 491
25fcce25 492 newtPopWindow();
72d80898 493
25fcce25 494 // Execute the formatting...
5315fae6 495 statuswindow(60, 4, title, _("Creating filesystems..."));
b8e2d108 496
25fcce25
MT
497 rc = hw_create_filesystems(destination);
498 if (rc) {
5315fae6 499 errorbox(_("Unable to create filesystems."));
72d80898
MT
500 goto EXIT;
501 }
25fcce25
MT
502
503 rc = hw_mount_filesystems(destination, DESTINATION_MOUNT_PATH);
504 if (rc) {
5315fae6 505 errorbox(_("Unable to mount filesystems."));
72d80898 506 goto EXIT;
9607771a 507 }
c78a77eb 508
25fcce25
MT
509 newtPopWindow();
510
511 // Extract files...
03d956be 512 snprintf(commandstring, STRING_SIZE,
5315fae6
MT
513 "/bin/tar -C /harddisk -xvf /cdrom/distro.img --lzma 2>/dev/null");
514
edd536b6 515 if (runcommandwithprogress(60, 4, title, commandstring, INST_FILECOUNT,
5315fae6
MT
516 _("Installing the system..."))) {
517 errorbox(_("Unable to install the system."));
d6aaa55d
MT
518 goto EXIT;
519 }
7f69d8a4
MT
520
521 // Write fstab
522 rc = hw_write_fstab(destination);
523 if (rc) {
524 fprintf(flog, "Could not write /etc/fstab\n");
525 goto EXIT;
526 }
527
406f019f
MT
528 /* Save language und local settings */
529 write_lang_configs(shortlangname);
d6aaa55d 530
330345c2 531 /* Build cache lang file */
6cf9e770 532 snprintf(commandstring, STRING_SIZE, "/usr/sbin/chroot /harddisk /usr/bin/perl -e \"require '" CONFIG_ROOT "/lang.pl'; &Lang::BuildCacheLang\"");
5315fae6
MT
533 if (runcommandwithstatus(commandstring, title, _("Installing the language cache..."))) {
534 errorbox(_("Unable to install the language cache."));
330345c2
MT
535 goto EXIT;
536 }
537
f5007e9c 538 // Installing bootloader...
5315fae6 539 statuswindow(60, 4, title, _("Installing the bootloader..."));
423400cf 540
f5007e9c
MT
541 rc = hw_install_bootloader(destination);
542 if (rc) {
5315fae6 543 errorbox(_("Unable to install the bootloader."));
edd536b6
MT
544 goto EXIT;
545 }
5faa66cf 546
f5007e9c
MT
547 newtPopWindow();
548
5faa66cf
AF
549 /* Serial console ? */
550 if (serialconsole) {
551 /* grub */
552 replace("/harddisk/boot/grub/grub.conf", "splashimage", "#splashimage");
553 replace("/harddisk/boot/grub/grub.conf", "#serial", "serial");
554 replace("/harddisk/boot/grub/grub.conf", "#terminal", "terminal");
1445c9e0 555 replace("/harddisk/boot/grub/grub.conf", " panic=10 ", " console=ttyS0,115200n8 panic=10 ");
5faa66cf
AF
556
557 /*inittab*/
558 replace("/harddisk/etc/inittab", "1:2345:respawn:", "#1:2345:respawn:");
559 replace("/harddisk/etc/inittab", "2:2345:respawn:", "#2:2345:respawn:");
560 replace("/harddisk/etc/inittab", "3:2345:respawn:", "#3:2345:respawn:");
561 replace("/harddisk/etc/inittab", "4:2345:respawn:", "#4:2345:respawn:");
562 replace("/harddisk/etc/inittab", "5:2345:respawn:", "#5:2345:respawn:");
563 replace("/harddisk/etc/inittab", "6:2345:respawn:", "#6:2345:respawn:");
564 replace("/harddisk/etc/inittab", "#7:2345:respawn:", "7:2345:respawn:");
565 }
566
dfa59dbd
AF
567 /* Set marker that the user has already accepted the gpl */
568 mysystem("/usr/bin/touch /harddisk/var/ipfire/main/gpl_accepted");
569
c25a0343 570 /* Copy restore file from cdrom */
7062cecd 571 if (unattended && (strlen(restore_file) > 0)) {
c25a0343 572 fprintf(flog, "unattended: Copy restore file\n");
dca095e1 573 snprintf(commandstring, STRING_SIZE,
c25a0343 574 "cp /cdrom/%s /harddisk/var/ipfire/backup", restore_file);
dca095e1 575 mysystem(commandstring);
c25a0343 576 }
2c9c458c
MT
577
578 // Umount source drive and eject
579 hw_umount(SOURCE_MOUNT_PATH);
580
581 snprintf(commandstring, STRING_SIZE, "/usr/bin/eject %s", sourcedrive);
3ef6c343 582 mysystem(commandstring);
22b9e405 583
73d9a908 584 if (!unattended) {
5315fae6
MT
585 snprintf(message, sizeof(message), _("%s was successfully installed. "
586 "Please remove any installation mediums from this system. "
587 "Setup will now run where you may configure networking and the system passwords. "
588 "After Setup has been completed, you should point your web browser at https://%s:444 "
589 "(or whatever you name your %s), and configure dialup networking (if required) and "
590 "remote access."), NAME, SNAME, NAME);
591 newtWinMessage(_("Congratulations!"), _("Reboot"), message);
73d9a908 592 }
cd8dd8dd 593
22b9e405 594 allok = 1;
edd536b6 595
d6aaa55d 596EXIT:
10bc6f06 597 fprintf(flog, "Install program ended.\n");
d6aaa55d 598
10bc6f06 599 if (!(allok))
5315fae6 600 newtWinMessage(title, _("OK"), _("Press Ok to reboot."));
d6aaa55d 601
25fcce25 602 if (allok) {
ee78a5ef
MT
603 fflush(flog);
604 fclose(flog);
3a1019f6
MT
605 }
606
607 newtFinished();
608
f0fa1795
MT
609 // Free resources
610 free(sourcedrive);
25fcce25
MT
611
612 if (destination) {
613 hw_umount_filesystems(destination, DESTINATION_MOUNT_PATH);
614 free(destination);
615 }
d7dd283b 616
4a0d9bef
MT
617 hw_stop_all_raid_arrays();
618
d7dd283b
MT
619 if (selected_disks)
620 hw_free_disks(selected_disks);
621
622 hw_free(hw);
f0fa1795 623
25fcce25
MT
624 fcloseall();
625
f0a61a0a
MT
626 if (allok == 1)
627 return 0;
25fcce25 628
f0a61a0a 629 return 1;
d6aaa55d 630}