]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/install/main.c
Removed also the pata mkinitcpio hook if install on hda
[people/pmueller/ipfire-2.x.git] / src / install+setup / install / main.c
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
7 * Contains main entry point, and misc functions.6
8 *
9 */
10
11 #include "install.h"
12 #define _GNU_SOURCE
13
14 #define INST_FILECOUNT 6200
15 #define UNATTENDED_CONF "/cdrom/boot/unattended.conf"
16
17 #define REISER4 0
18 #define REISERFS 1
19 #define EXT3 2
20
21 FILE *flog = NULL;
22 char *mylog;
23
24 char **ctr;
25
26 extern char url[STRING_SIZE];
27
28 struct nic nics[20] = { { "" , "" , "" } }; // only defined for compile
29 struct knic knics[20] = { { "" , "" , "" , "" } }; // only defined for compile
30
31 extern char *en_tr[];
32 extern char *de_tr[];
33
34 int main(int argc, char *argv[])
35 {
36 char *langnames[] = { "Deutsch", "English", NULL };
37 char *shortlangnames[] = { "de", "en", NULL };
38 char **langtrs[] = { de_tr, en_tr, NULL };
39 char hdletter;
40 char harddrive[30], sourcedrive[5]; /* Device holder. */
41 struct devparams hdparams, cdromparams; /* Params for CDROM and HD */
42 int rc = 0;
43 char commandstring[STRING_SIZE];
44 char mkfscommand[STRING_SIZE];
45 char *fstypes[] = { "Reiser4", "ReiserFS", "ext3", NULL };
46 int fstype = REISER4;
47 int choice;
48 int i;
49 int found = 0;
50 int firstrun = 0;
51 char shortlangname[10];
52 char message[1000];
53 char title[STRING_SIZE];
54 int allok = 0;
55 int allok_fastexit=0;
56 int raid_disk = 0;
57 struct keyvalue *ethernetkv = initkeyvalues();
58 FILE *handle, *cmdfile;
59 char line[STRING_SIZE];
60 char string[STRING_SIZE];
61 long memory = 0, disk = 0, free;
62 long system_partition, boot_partition, root_partition, swap_file;
63 int scsi_disk = 0;
64 char *yesnoharddisk[3]; // char *yesnoharddisk = { "NO", "YES", NULL };
65
66 int unattended = 0;
67 struct keyvalue *unattendedkv = initkeyvalues();
68 int hardyn = 0;
69
70 setlocale (LC_ALL, "");
71 sethostname( SNAME , 10);
72
73 memset(&hdparams, 0, sizeof(struct devparams));
74 memset(&cdromparams, 0, sizeof(struct devparams));
75
76 /* Log file/terminal stuff. */
77 if (argc >= 2)
78 {
79 if (!(flog = fopen(argv[1], "w+")))
80 return 0;
81 }
82 else
83 return 0;
84
85 mylog = argv[1];
86
87 fprintf(flog, "Install program started.\n");
88
89 newtInit();
90 newtCls();
91
92 /* Do usb detection first for usb keyboard */
93 if (! (cmdfile = fopen("/proc/cmdline", "r")))
94 {
95 fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
96 } else {
97 fgets(line, STRING_SIZE, cmdfile);
98
99 // check if we have to make an unattended install
100 if (strstr (line, "unattended") != NULL) {
101 unattended = 1;
102 runcommandwithstatus("/bin/sleep 10", "WARNING: Unattended installation will start in 10 seconds...");
103 }
104 }
105
106 mysystem("/sbin/modprobe ide-generic");
107 mysystem("/sbin/modprobe generic");
108 mysystem("/sbin/modprobe ide-cd");
109 mysystem("/sbin/modprobe ide-disk");
110 mysystem("/sbin/modprobe uhci-hcd");
111 mysystem("/sbin/modprobe ohci-hcd");
112 mysystem("/sbin/modprobe ehci-hcd");
113 mysystem("/sbin/modprobe ohci1394");
114 mysystem("/sbin/modprobe sd_mod");
115 mysystem("/sbin/modprobe sr_mod");
116 mysystem("/sbin/modprobe usb-storage");
117 mysystem("/sbin/modprobe usbhid");
118
119 mysystem("/sbin/modprobe iso9660"); // CDROM
120 mysystem("/sbin/modprobe ext2"); // Boot patition
121 mysystem("/sbin/modprobe vfat"); // USB key
122
123 /* German is the default */
124 for (choice = 0; langnames[choice]; choice++)
125 {
126 if (strcmp(langnames[choice], "Deutsch") == 0)
127 break;
128 }
129 if (!langnames[choice])
130 goto EXIT;
131
132 if (!unattended) {
133 rc = newtWinMenu("Language selection", "Select the language you wish to use for the " NAME ".", 50, 5, 5, 8,
134 langnames, &choice, "Ok", NULL);
135 }
136
137 ctr = langtrs[choice];
138 strcpy(shortlangname, shortlangnames[choice]);
139
140 newtDrawRootText(14, 0, NAME " " VERSION " - " SLOGAN );
141 newtPushHelpLine(ctr[TR_HELPLINE]);
142 sprintf (title, "%s %s - %s", NAME, VERSION, SLOGAN);
143
144 // Starting hardware detection
145 runcommandwithstatus("/bin/probehw.sh", ctr[TR_PROBING_HARDWARE]);
146
147 sprintf(message, ctr[TR_WELCOME], NAME);
148 newtWinMessage(title, ctr[TR_OK], message);
149
150 switch (mysystem("/bin/mountsource.sh")) {
151 case 0:
152 break;
153 case 10:
154 errorbox(ctr[TR_NO_CDROM]);
155 goto EXIT;
156 }
157
158 /* read source drive letter */
159 if ((handle = fopen("/tmp/source_device", "r")) == NULL) {
160 errorbox(ctr[TR_ERROR_PROBING_CDROM]);
161 goto EXIT;
162 }
163 fgets(sourcedrive, 5, handle);
164 fprintf(flog, "Source drive: %s\n", sourcedrive);
165 fclose(handle);
166
167 i = 0;
168 while (found == 0) {
169 i++;
170 fprintf(flog, "Harddisk scan pass %i\n", i);
171
172 switch (mysystem("/bin/mountdest.sh") % 255) {
173 case 0: // Found IDE disk
174 scsi_disk = 0;
175 raid_disk = 0;
176 found = 1;
177 break;
178 case 1: // Found SCSI disk
179 scsi_disk = 1;
180 raid_disk = 0;
181 found = 1;
182 break;
183 case 2: // Found RAID disk
184 scsi_disk = 0;
185 raid_disk= 1;
186 found = 1;
187 break;
188 case 10: // No harddisk found
189 if (firstrun == 1) {
190 errorbox(ctr[TR_NO_HARDDISK]);
191 goto EXIT;
192 }
193 // Do this if the kudzu-scan fails...
194 runcommandwithstatus("/bin/probehw.sh deep-scan", ctr[TR_PROBING_HARDWARE]);
195 firstrun = 1;
196 }
197 }
198
199 if ((handle = fopen("/tmp/dest_device", "r")) == NULL) {
200 errorbox(ctr[TR_NO_HARDDISK]);
201 goto EXIT;
202 }
203 fgets(harddrive, 30, handle);
204 fclose(handle);
205
206 /* load unattended configuration */
207 if (unattended) {
208 fprintf(flog, "unattended: Reading unattended.conf\n");
209
210 (void) readkeyvalues(unattendedkv, UNATTENDED_CONF);
211 }
212
213 /* Make the hdparms struct and print the contents.
214 With USB-KEY install and SCSI disk, while installing, the disk
215 is named 'sdb,sdc,...' (following keys)
216 On reboot, it will become 'sda'
217 To avoid many test, all names are built in the struct.
218 */
219 sprintf(hdparams.devnode_disk, "/dev/%s", harddrive);
220 /* Address the partition or raid partition (eg dev/sda or /dev/sdap1 */
221 sprintf(hdparams.devnode_part, "/dev/%s%s", harddrive,raid_disk ? "p" : "");
222 /* Now the names after the machine is booted. Only scsi is affected
223 and we only install on the first scsi disk. */
224 { char tmp[30];
225 strcpy(tmp, scsi_disk ? "sda" : harddrive);
226 sprintf(hdparams.devnode_disk_run, "/dev/%s", tmp);
227 sprintf(hdparams.devnode_part_run, "/dev/%s%s", tmp, raid_disk ? "p" : "");
228 }
229
230 fprintf(flog, "Destination drive: %s\n", hdparams.devnode_disk);
231
232 sprintf(message, ctr[TR_PREPARE_HARDDISK], hdparams.devnode_disk);
233 if (unattended) {
234 hardyn = 1;
235 } else {
236 yesnoharddisk[0] = ctr[TR_NO];
237 yesnoharddisk[1] = ctr[TR_YES];
238 yesnoharddisk[2] = NULL;
239 }
240
241 while (! hardyn) {
242 rc = newtWinMenu(title, message,
243 50, 5, 5, 6, yesnoharddisk,
244 &hardyn, ctr[TR_OK],
245 ctr[TR_CANCEL], NULL);
246 if (rc == 2)
247 goto EXIT;
248 }
249 if (rc == 2)
250 goto EXIT;
251
252 if (!unattended) {
253 sprintf(message, ctr[TR_CHOOSE_FILESYSTEM]);
254 rc = newtWinMenu( ctr[TR_CHOOSE_FILESYSTEM], message,
255 50, 5, 5, 6, fstypes, &fstype, ctr[TR_OK],
256 ctr[TR_CANCEL], NULL);
257 } else {
258 rc = 1;
259 fstype = REISER4; // Reiser4 is our standard filesystem. Love it or shut up!
260 }
261 if (rc == 2)
262 goto EXIT;
263
264 /* Calculate amount of memory in machine */
265 if ((handle = fopen("/proc/meminfo", "r")))
266 {
267 while (fgets(line, STRING_SIZE-1, handle)) {
268 if (sscanf (line, "MemTotal: %s kB", string)) {
269 memory = atoi(string) / 1024 ;
270 }
271 }
272 fclose(handle);
273 }
274
275 /* Partition, mkswp, mkfs.
276 * before partitioning, first determine the sizes of each
277 * partition. In order to do that we need to know the size of
278 * the disk.
279 */
280 /* Don't use mysystem here so we can redirect output */
281 sprintf(commandstring, "/bin/sfdisk -s /dev/%s > /tmp/disksize 2> /dev/null", harddrive);
282 system(commandstring);
283
284 /* Calculate amount of disk space */
285 if ((handle = fopen("/tmp/disksize", "r"))) {
286 fgets(line, STRING_SIZE-1, handle);
287 if (sscanf (line, "%s", string)) {
288 disk = atoi(string) / 1024;
289 }
290 fclose(handle);
291 }
292
293 fprintf(flog, "Disksize = %ld, memory = %ld", disk, memory);
294
295 /* Calculating Swap-Size dependend of Ram Size */
296 if (memory < 128)
297 swap_file = 32;
298 else if (memory >= 1024)
299 swap_file = 512;
300 else
301 swap_file = memory;
302
303 /* Calculating Root-Size dependend of Max Disk Space */
304 if ( disk < 756 )
305 root_partition = 200;
306 else if ( disk >= 756 && disk <= 3072 )
307 root_partition = 512;
308 else
309 root_partition = 2048;
310
311
312 /* Calculating the amount of free space */
313 boot_partition = 20; /* in MB */
314 system_partition = disk - ( root_partition + swap_file + boot_partition );
315
316 fprintf(flog, ", boot = %ld, swap = %ld, mylog = %ld, root = %ld\n",
317 boot_partition, swap_file, system_partition, root_partition);
318 rc = 0;
319
320 if ( (!unattended) && (((disk - (root_partition + swap_file + boot_partition)) < 256 ) && ((disk - (root_partition + boot_partition )) > 256)) ) {
321 rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], ctr[TR_CONTINUE_NO_SWAP]);
322 if (rc == 1){
323 swap_file = 0;
324 system_partition = disk - ( root_partition + swap_file + boot_partition );
325 fprintf(flog, "Changing Swap Size to 0 MB.\n");
326 }
327 else if (rc == 2){
328 fprintf(flog, "Disk is too small.\n");
329 errorbox(ctr[TR_DISK_TOO_SMALL]);goto EXIT;
330 }
331 }
332 else if (disk - (root_partition + swap_file + boot_partition) >= 256) {
333
334 }
335 else {
336 fprintf(flog, "Disk is too small.\n");
337 errorbox(ctr[TR_DISK_TOO_SMALL]);goto EXIT;
338 }
339
340 handle = fopen("/tmp/partitiontable", "w");
341
342 /* Make swapfile */
343 if (swap_file) {
344 fprintf(handle, ",%ld,L,*\n,%ld,S,\n,%ld,L,\n,,L,\n",
345 boot_partition, swap_file, root_partition);
346 } else {
347 fprintf(handle, ",%ld,L,*\n,0,0,\n,%ld,L,\n,,L,\n",
348 boot_partition, root_partition);
349 }
350
351 fclose(handle);
352
353 snprintf(commandstring, STRING_SIZE, "/bin/sfdisk -L -uM %s < /tmp/partitiontable", hdparams.devnode_disk);
354 if (runcommandwithstatus(commandstring, ctr[TR_PARTITIONING_DISK]))
355 {
356 errorbox(ctr[TR_UNABLE_TO_PARTITION]);
357 goto EXIT;
358 }
359
360 if (fstype == REISER4) {
361 mysystem("/sbin/modprobe reiser4");
362 sprintf(mkfscommand, "/sbin/mkfs.reiser4 -y");
363 } else if (fstype == REISERFS) {
364 mysystem("/sbin/modprobe reiserfs");
365 sprintf(mkfscommand, "/sbin/mkreiserfs -f");
366 } else if (fstype == EXT3) {
367 mysystem("/sbin/modprobe ext3");
368 sprintf(mkfscommand, "/sbin/mke2fs -T ext3 -c");
369 }
370
371 snprintf(commandstring, STRING_SIZE, "/sbin/mke2fs -T ext2 -c %s1", hdparams.devnode_part);
372 if (runcommandwithstatus(commandstring, ctr[TR_MAKING_BOOT_FILESYSTEM]))
373 {
374 errorbox(ctr[TR_UNABLE_TO_MAKE_BOOT_FILESYSTEM]);
375 goto EXIT;
376 }
377
378 if (swap_file) {
379 snprintf(commandstring, STRING_SIZE, "/sbin/mkswap %s2", hdparams.devnode_part);
380 if (runcommandwithstatus(commandstring, ctr[TR_MAKING_SWAPSPACE]))
381 {
382 errorbox(ctr[TR_UNABLE_TO_MAKE_SWAPSPACE]);
383 goto EXIT;
384 }
385 }
386
387 snprintf(commandstring, STRING_SIZE, "%s %s3", mkfscommand, hdparams.devnode_part);
388 if (runcommandwithstatus(commandstring, ctr[TR_MAKING_ROOT_FILESYSTEM]))
389 {
390 errorbox(ctr[TR_UNABLE_TO_MAKE_ROOT_FILESYSTEM]);
391 goto EXIT;
392 }
393
394 snprintf(commandstring, STRING_SIZE, "%s %s4", mkfscommand, hdparams.devnode_part);
395 if (runcommandwithstatus(commandstring, ctr[TR_MAKING_LOG_FILESYSTEM]))
396 {
397 errorbox(ctr[TR_UNABLE_TO_MAKE_LOG_FILESYSTEM]);
398 goto EXIT;
399 }
400
401 snprintf(commandstring, STRING_SIZE, "/bin/mount %s3 /harddisk", hdparams.devnode_part);
402 if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_ROOT_FILESYSTEM]))
403 {
404 errorbox(ctr[TR_UNABLE_TO_MOUNT_ROOT_FILESYSTEM]);
405 goto EXIT;
406 }
407
408 mkdir("/harddisk/boot", S_IRWXU|S_IRWXG|S_IRWXO);
409 mkdir("/harddisk/var", S_IRWXU|S_IRWXG|S_IRWXO);
410 mkdir("/harddisk/var/log", S_IRWXU|S_IRWXG|S_IRWXO);
411
412 snprintf(commandstring, STRING_SIZE, "/bin/mount %s1 /harddisk/boot", hdparams.devnode_part);
413 if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_BOOT_FILESYSTEM]))
414 {
415 errorbox(ctr[TR_UNABLE_TO_MOUNT_BOOT_FILESYSTEM]);
416 goto EXIT;
417 }
418 if (swap_file) {
419 snprintf(commandstring, STRING_SIZE, "/sbin/swapon %s2", hdparams.devnode_part);
420 if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_SWAP_PARTITION]))
421 {
422 errorbox(ctr[TR_UNABLE_TO_MOUNT_SWAP_PARTITION]);
423 goto EXIT;
424 }
425 }
426 snprintf(commandstring, STRING_SIZE, "/bin/mount %s4 /harddisk/var", hdparams.devnode_part);
427 if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_LOG_FILESYSTEM]))
428 {
429 errorbox(ctr[TR_UNABLE_TO_MOUNT_LOG_FILESYSTEM]);
430 goto EXIT;
431 }
432
433 snprintf(commandstring, STRING_SIZE,
434 "/bin/tar -C /harddisk -xvjf /cdrom/" SNAME "-" VERSION ".tbz2");
435
436 if (runcommandwithprogress(60, 4, title, commandstring, INST_FILECOUNT,
437 ctr[TR_INSTALLING_FILES]))
438 {
439 errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]);
440 goto EXIT;
441 }
442
443 /* Save language und local settings */
444 write_lang_configs(shortlangname);
445
446 /* touch the modules.dep files */
447 snprintf(commandstring, STRING_SIZE,
448 "/bin/touch /harddisk/lib/modules/%s-ipfire/modules.dep",
449 KERNEL_VERSION);
450 mysystem(commandstring);
451 snprintf(commandstring, STRING_SIZE,
452 "/bin/touch /harddisk/lib/modules/%s-ipfire-smp/modules.dep",
453 KERNEL_VERSION);
454 mysystem(commandstring);
455
456 /* Rename uname */
457 rename ("/harddisk/bin/uname.bak", "/harddisk/bin/uname");
458
459 /* mount proc filesystem */
460 mysystem("mkdir /harddisk/proc");
461 mysystem("/bin/mount --bind /proc /harddisk/proc");
462 mysystem("/bin/mount --bind /dev /harddisk/dev");
463 mysystem("/bin/mount --bind /sys /harddisk/sys");
464
465 /* Build cache lang file */
466 snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /usr/bin/perl -e \"require '" CONFIG_ROOT "/lang.pl'; &Lang::BuildCacheLang\"");
467 if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_LANG_CACHE]))
468 {
469 errorbox(ctr[TR_UNABLE_TO_INSTALL_LANG_CACHE]);
470 goto EXIT;
471 }
472
473 /* Update /etc/fstab */
474 replace("/harddisk/etc/fstab", "DEVICE", hdparams.devnode_part_run);
475
476 if (fstype == REISER4) {
477 replace("/harddisk/etc/fstab", "FSTYPE", "reiser4");
478 replace("/harddisk/etc/mkinitcpio.conf", "MODULES=\"", "MODULES=\"reiser4 ");
479 replace("/harddisk/boot/grub/grub.conf", "MOUNT", "rw");
480 } else if (fstype == REISERFS) {
481 replace("/harddisk/etc/fstab", "FSTYPE", "reiserfs");
482 replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
483 } else if (fstype == EXT3) {
484 snprintf(commandstring, STRING_SIZE, "tune2fs -j %s3", hdparams.devnode_part);
485 if (runcommandwithstatus(commandstring, ctr[TR_JOURNAL_EXT3]))
486 {
487 errorbox(ctr[TR_JOURNAL_ERROR]);
488 replace("/harddisk/etc/fstab", "FSTYPE", "ext2");
489 goto NOJOURNAL;
490 }
491 snprintf(commandstring, STRING_SIZE, "tune2fs -j %s4", hdparams.devnode_part);
492 if (runcommandwithstatus(commandstring, ctr[TR_JOURNAL_EXT3]))
493 {
494 errorbox(ctr[TR_JOURNAL_ERROR]);
495 replace("/harddisk/etc/fstab", "FSTYPE", "ext2");
496 goto NOJOURNAL;
497 }
498 replace("/harddisk/etc/fstab", "FSTYPE", "ext3");
499 NOJOURNAL:
500 replace("/harddisk/etc/mkinitcpio.conf", "MODULES=\"", "MODULES=\"ext3 ");
501 replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
502 }
503
504 /* mkinitcpio has a problem if ide and pata are included */
505 if ( scsi_disk==1 ) {
506 /* Remove the ide hook if we install sda */
507 replace("/harddisk/etc/mkinitcpio.conf", " ide ", " ");
508 } else {
509 /* Remove the pata hook if we install hda */
510 replace("/harddisk/etc/mkinitcpio.conf", " pata ", " ");
511 }
512 /* Going to make our initrd... */
513 snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd.img -k %s-ipfire", KERNEL_VERSION);
514 runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
515 snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd-smp.img -k %s-ipfire-smp", KERNEL_VERSION);
516 runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
517
518 sprintf(string, "root=%s3", hdparams.devnode_part_run);
519 replace( "/harddisk/boot/grub/grub.conf", "root=ROOT", string);
520 mysystem("ln -s grub.conf /harddisk/boot/grub/menu.lst");
521
522 system("sed -e 's#harddisk\\/##g' < /proc/mounts > /harddisk/etc/mtab");
523
524 snprintf(commandstring, STRING_SIZE,
525 "/sbin/chroot /harddisk /usr/sbin/grub-install --no-floppy %s", hdparams.devnode_disk);
526 if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_GRUB])) {
527 errorbox(ctr[TR_UNABLE_TO_INSTALL_GRUB]);
528 goto EXIT;
529 }
530
531 mysystem("umount /cdrom");
532 snprintf(commandstring, STRING_SIZE, "eject /dev/%s", sourcedrive);
533 mysystem(commandstring);
534
535 if (!unattended) {
536 sprintf(message, ctr[TR_CONGRATULATIONS_LONG],
537 NAME, SNAME, NAME);
538 newtWinMessage(ctr[TR_CONGRATULATIONS], ctr[TR_OK], message);
539 }
540
541 allok = 1;
542
543 EXIT:
544 fprintf(flog, "Install program ended.\n");
545
546 if (!(allok))
547 newtWinMessage(title, ctr[TR_OK], ctr[TR_PRESS_OK_TO_REBOOT]);
548
549 freekeyvalues(ethernetkv);
550
551 if (allok && !allok_fastexit)
552 {
553 if (unattended) {
554 fprintf(flog, "Entering unattended setup\n");
555 if (unattended_setup(unattendedkv)) {
556 snprintf(commandstring, STRING_SIZE, "/bin/sleep 10");
557 runcommandwithstatus(commandstring, "Unattended installation finished, system will reboot");
558 } else {
559 errorbox("Unattended setup failed.");
560 goto EXIT;
561 }
562 }
563
564 fflush(flog);
565 fclose(flog);
566 newtFinished();
567
568 if (!unattended) {
569 if (system("/sbin/chroot /harddisk /usr/local/sbin/setup /dev/tty2 INSTALL"))
570 printf("Unable to run setup.\n");
571 }
572
573 if (system("/bin/umount /harddisk/proc"))
574 printf("Unable to umount /harddisk/proc.\n");
575 } else {
576 fflush(flog);
577 fclose(flog);
578 newtFinished();
579 }
580
581 fcloseall();
582
583 if (swap_file) {
584 snprintf(commandstring, STRING_SIZE, "/bin/swapoff %s2", hdparams.devnode_part);
585 }
586
587 newtFinished();
588
589 system("/bin/umount /harddisk/proc");
590 system("/bin/umount /harddisk/dev");
591 system("/bin/umount /harddisk/sys");
592
593 system("/bin/umount /harddisk/var");
594 system("/bin/umount /harddisk/boot");
595 system("/bin/umount /harddisk");
596
597 system("/etc/halt");
598
599 return 0;
600 }