Erste Teile der neuen Netzwerkscripte.
[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.
8 *
9 */
10
11 #include "install.h"
12 #define _GNU_SOURCE
13
14 #define CDROM_INSTALL 0
15 #define URL_INSTALL 1
16 #define DISK_INSTALL 2
17 #define INST_FILECOUNT 7000
18 #define UNATTENDED_CONF "/cdrom/boot/unattended.conf"
19
20 int raid_disk = 0;
21 FILE *flog = NULL;
22 char *mylog;
23
24 char **ctr;
25
26 extern char url[STRING_SIZE];
27
28 extern char *en_tr[];
29 extern char *de_tr[];
30
31 int detect_smp() {
32 FILE *fd = NULL;
33 char line[STRING_SIZE];
34 int cpu_count = 0;
35
36 if ((fd = fopen("/proc/cpuinfo", "r")) == NULL) {
37 return 0;
38 }
39 while (fgets(line, STRING_SIZE, fd) != NULL) {
40 if (strstr(line, "processor") == line) {
41 cpu_count++;
42 }
43 }
44 (void)fclose(fd);
45 return (cpu_count > 1);
46 }
47
48 long calc_swapsize(long memory, long disk) {
49 if (memory < 128) {
50 return 256;
51 }
52 if (memory > 1024) {
53 return 512;
54 }
55
56 return memory*2;
57 }
58
59 int main(int argc, char *argv[])
60 {
61 char *langnames[] = { "Deutsch", "English", NULL };
62 char *shortlangnames[] = { "de", "en", NULL };
63 char **langtrs[] = { de_tr, en_tr, NULL };
64 char hdletter;
65 char harddrive[5], sourcedrive[5]; /* Device holder. */
66 struct devparams hdparams, cdromparams; /* Params for CDROM and HD */
67 int cdmounted = 0; /* Loop flag for inserting a cd. */
68 int rc = 0;
69 char commandstring[STRING_SIZE];
70 char *installtypes[] = { "CDROM/USB", "HTTP/FTP", NULL };
71 int installtype = CDROM_INSTALL;
72 int choice;
73 char shortlangname[10];
74 char message[1000];
75 char title[STRING_SIZE];
76 int allok = 0;
77 int allok_fastexit=0;
78 struct keyvalue *ethernetkv = initkeyvalues();
79 FILE *handle, *cmdfile;
80 char line[STRING_SIZE];
81 char string[STRING_SIZE];
82 long maximum_free = 0, current_free;
83 long memory = 0;
84 long system_partition, boot_partition, root_partition, swap_file;
85 int scsi_disk = 0;
86 char *yesnoharddisk[] = { "NO", "YES", NULL };
87 int unattended = 0;
88 struct keyvalue *unattendedkv = initkeyvalues();
89 int hardyn = 0;
90
91 setlocale (LC_ALL, "");
92 sethostname( SNAME , 10);
93
94 memset(&hdparams, 0, sizeof(struct devparams));
95 memset(&cdromparams, 0, sizeof(struct devparams));
96
97 /* Log file/terminal stuff. */
98 if (argc >= 2)
99 {
100 if (!(flog = fopen(argv[1], "w+")))
101 return 0;
102 }
103 else
104 return 0;
105
106 mylog = argv[1];
107
108 fprintf(flog, "Install program started.\n");
109
110 newtInit();
111 newtCls();
112
113 /* Do usb detection first for usb keyboard */
114 if (! (cmdfile = fopen("/proc/cmdline", "r")))
115 {
116 fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
117 } else {
118 fgets(line, STRING_SIZE, cmdfile);
119 if (strstr (line, "nousb") == NULL) {
120 fprintf(flog, "Initializing USB controllers.\n");
121 initialize_usb();
122 } else {
123 fprintf(flog, "Skipping USB detection.\n");
124 }
125 // check if we have to make an unattended install
126 if (strstr (line, "unattended") != NULL) {
127 unattended = 1;
128 }
129 }
130
131 if (unattended) {
132 runcommandwithstatus("/bin/sleep 10", "WARNING: Unattended installation will start in 10 seconds...");
133 }
134
135 /* German is the default */
136 for (choice = 0; langnames[choice]; choice++)
137 {
138 if (strcmp(langnames[choice], "Deutsch") == 0)
139 break;
140 }
141 if (!langnames[choice])
142 goto EXIT;
143
144 if (!unattended) {
145 rc = newtWinMenu("Language selection",
146 "Select the language you wish to use for the " NAME ".", 50, 5, 5, 8,
147 langnames, &choice, "Ok", NULL);
148 }
149
150 ctr = langtrs[choice];
151 strcpy(shortlangname, shortlangnames[choice]);
152
153 mysystem("/bin/setfont lat0-16");
154
155 newtDrawRootText(14, 0, NAME " " VERSION " - " SLOGAN );
156 newtPushHelpLine(ctr[TR_HELPLINE]);
157 sprintf (title, "%s %s - %s", NAME, VERSION, SLOGAN);
158
159 if (!unattended) {
160 sprintf(message, ctr[TR_WELCOME], NAME);
161 newtWinMessage(title, ctr[TR_OK], message);
162
163 sprintf(message, ctr[TR_SELECT_INSTALLATION_MEDIA_LONG], NAME);
164 rc = newtWinMenu(ctr[TR_SELECT_INSTALLATION_MEDIA], message,
165 50, 5, 5, 6, installtypes, &installtype, ctr[TR_OK],
166 ctr[TR_CANCEL], NULL);
167 } else {
168 rc = 1;
169 installtype = CDROM_INSTALL;
170 }
171
172 if (rc == 2)
173 goto EXIT;
174
175 // Starting hardware detection
176 runcommandwithstatus("/bin/probehw.sh", ctr[TR_PROBING_HARDWARE]);
177
178 /* CDROM INSTALL */
179 if (installtype == CDROM_INSTALL) {
180 switch (mysystem("/bin/mountsource.sh")) {
181 case 0:
182 installtype = CDROM_INSTALL;
183 cdmounted = 1;
184 break;
185 case 1:
186 installtype = DISK_INSTALL;
187 break;
188 case 10:
189 errorbox(ctr[TR_NO_CDROM]);
190 goto EXIT;
191 }
192
193 /* read source drive letter */
194 if ((handle = fopen("/tmp/source_device", "r")) == NULL) {
195 errorbox(ctr[TR_ERROR_PROBING_CDROM]);
196 goto EXIT;
197 }
198 fgets(sourcedrive, 5, handle);
199 fprintf(flog, "Source drive: %s\n", sourcedrive);
200 fclose(handle);
201
202 snprintf(cdromparams.devnode, STRING_SIZE, "/dev/%s", sourcedrive);
203 cdromparams.module = 0;
204 fprintf(flog, "Source device: %s\n", cdromparams.devnode);
205 }
206
207 /* Configure the network now! */
208 if (installtype == URL_INSTALL) {
209 /* Network driver and params. */
210 if (!(networkmenu(ethernetkv))) {
211 errorbox(ctr[TR_NETWORK_SETUP_FAILED]);
212 goto EXIT;
213 }
214
215 /* Check for ipfire-<VERSION>.tbz2 */
216 if (checktarball(SNAME "-" VERSION ".tbz2", ctr[TR_ENTER_URL])) {
217 errorbox(ctr[TR_NO_IPCOP_TARBALL_FOUND]);
218 goto EXIT;
219 }
220 }
221
222 /* Get device for the HD. This has to succeed. */
223 if (!(hdletter = findidetype(IDE_HD)))
224 {
225 /* Need to clean this up at some point */
226 if (!try_scsi("sda") || strstr(sourcedrive, "sda") != NULL) {
227 if (!try_scsi("ida/c0d0")) {
228 if (!try_scsi("cciss/c0d0")) {
229 if (!try_scsi("rd/c0d0")) {
230 if (!try_scsi("ataraid/d0")) {
231 errorbox(ctr[TR_NO_HARDDISK]);
232 goto EXIT;
233 } else {
234 raid_disk = 1;
235 sprintf(harddrive, "ataraid/d0");
236 }
237 } else {
238 raid_disk = 1;
239 sprintf(harddrive, "rd/c0d0");
240 }
241 } else {
242 raid_disk = 1;
243 sprintf(harddrive, "cciss/c0d0");
244 }
245 } else {
246 raid_disk = 1;
247 sprintf(harddrive, "ida/c0d0");
248 }
249 } else {
250 if (strstr(sourcedrive, "sda") != NULL) {
251 // probably installing from usb stick, try sdb
252 if (try_scsi("sdb")) {
253 sprintf(harddrive, "sdb");
254 }
255 else {
256 errorbox(ctr[TR_NO_HARDDISK]);
257 goto EXIT;
258 }
259 }
260 else {
261 sprintf(harddrive, "sda");
262 }
263 }
264 scsi_disk = 1;
265 } else
266 sprintf(harddrive, "hd%c", hdletter);
267
268 fprintf(flog, "Destination drive: %s\n", harddrive);
269
270 /* load unattended configuration */
271 if (unattended) {
272 fprintf(flog, "unattended: Reading unattended.conf\n");
273
274 (void) readkeyvalues(unattendedkv, UNATTENDED_CONF);
275 }
276
277 /* Make the hdparms struct and print the contents. */
278 snprintf(hdparams.devnode, STRING_SIZE, "/dev/%s", harddrive);
279 hdparams.module = 0;
280
281 sprintf(message, ctr[TR_PREPARE_HARDDISK], hdparams.devnode);
282
283 if (unattended) {
284 hardyn = 1;
285 }
286
287 while (! hardyn) {
288 rc = newtWinMenu(title, message,
289 50, 5, 5, 6, yesnoharddisk,
290 &hardyn, ctr[TR_OK],
291 ctr[TR_CANCEL], NULL);
292 if (rc == 2)
293 goto EXIT;
294 }
295
296 if (rc == 2)
297 goto EXIT;
298
299 /* Calculate amount of memory in machine */
300 if ((handle = fopen("/proc/meminfo", "r")))
301 {
302 while (fgets(line, STRING_SIZE-1, handle)) {
303 if (sscanf (line, "MemTotal: %s kB", string)) {
304 memory = atoi(string) / 1024 ;
305 }
306 }
307 fclose(handle);
308 }
309
310 /* Partition, mkswp, mkfs.
311 * before partitioning, first determine the sizes of each
312 * partition. In order to do that we need to know the size of
313 * the disk.
314 */
315 /* Don't use mysystem here so we can redirect output */
316 sprintf(commandstring, "/bin/sfdisk -s /dev/%s > /tmp/disksize 2> /dev/null", harddrive);
317 system(commandstring);
318
319 /* Calculate amount of disk space */
320 if ((handle = fopen("/tmp/disksize", "r")))
321 {
322 fgets(line, STRING_SIZE-1, handle);
323 if (sscanf (line, "%s", string)) {
324 maximum_free = atoi(string) / 1024;
325 }
326 fclose(handle);
327 }
328
329 fprintf(flog, "maximum_free = %ld, memory = %ld",
330 maximum_free, memory);
331
332 swap_file = calc_swapsize(memory, maximum_free);
333
334 if (maximum_free < 512 + swap_file ) {
335 if (maximum_free < 512) {
336 errorbox(ctr[TR_DISK_TOO_SMALL]);
337 goto EXIT;
338 }
339
340 if (!unattended) {
341 rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], ctr[TR_CONTINUE_NO_SWAP]);
342 }
343 else {
344 rc = 1;
345 }
346
347 if (rc != 1)
348 goto EXIT;
349 swap_file = 0;
350 }
351
352 boot_partition = 20; /* in MB */
353 current_free = maximum_free - boot_partition - swap_file;
354
355 root_partition = 2048 ;
356 if (current_free < 512) {
357 errorbox(ctr[TR_DISK_TOO_SMALL]);
358 goto EXIT;
359 }
360
361 current_free = current_free - root_partition;
362 if (!swap_file) {
363 root_partition = root_partition + swap_file;
364 }
365
366 system_partition = current_free;
367
368 fprintf(flog, "boot = %ld, swap = %ld, mylog = %ld, root = %ld\n",
369 boot_partition, swap_file, system_partition, root_partition);
370
371 handle = fopen("/tmp/partitiontable", "w");
372
373 /* Make swapfile */
374 if (swap_file) {
375 fprintf(handle, ",%ld,L,*\n,%ld,S,\n,%ld,L,\n,,L,\n",
376 boot_partition, swap_file, root_partition);
377 } else {
378 fprintf(handle, ",%ld,L,*\n,0,0,\n,%ld,L,\n,,L,\n",
379 boot_partition, root_partition);
380 }
381
382 fclose(handle);
383
384 snprintf(commandstring, STRING_SIZE, "/bin/sfdisk -L -uM %s < /tmp/partitiontable", hdparams.devnode);
385 if (runcommandwithstatus(commandstring, ctr[TR_PARTITIONING_DISK]))
386 {
387 errorbox(ctr[TR_UNABLE_TO_PARTITION]);
388 goto EXIT;
389 }
390
391 mysystem("/sbin/udevstart");
392
393 if (raid_disk)
394 snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -T ext2 -c %sp1", hdparams.devnode);
395 else
396 snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -T ext2 -c %s1", hdparams.devnode);
397 if (runcommandwithstatus(commandstring, ctr[TR_MAKING_BOOT_FILESYSTEM]))
398 {
399 errorbox(ctr[TR_UNABLE_TO_MAKE_BOOT_FILESYSTEM]);
400 goto EXIT;
401 }
402
403 if (swap_file) {
404 if (raid_disk)
405 snprintf(commandstring, STRING_SIZE, "/sbin/mkswap %sp2", hdparams.devnode);
406 else
407 snprintf(commandstring, STRING_SIZE, "/sbin/mkswap %s2", hdparams.devnode);
408 if (runcommandwithstatus(commandstring, ctr[TR_MAKING_SWAPSPACE]))
409 {
410 errorbox(ctr[TR_UNABLE_TO_MAKE_SWAPSPACE]);
411 goto EXIT;
412 }
413 }
414
415 if (raid_disk)
416 snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %sp3", hdparams.devnode);
417 else
418 snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %s3", hdparams.devnode);
419
420 if (runcommandwithstatus(commandstring, ctr[TR_MAKING_ROOT_FILESYSTEM]))
421 {
422 errorbox(ctr[TR_UNABLE_TO_MAKE_ROOT_FILESYSTEM]);
423 goto EXIT;
424 }
425
426 if (raid_disk)
427 snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %sp4", hdparams.devnode);
428 else
429 snprintf(commandstring, STRING_SIZE, "/sbin/mkreiserfs -f %s4", hdparams.devnode);
430
431 if (runcommandwithstatus(commandstring, ctr[TR_MAKING_LOG_FILESYSTEM]))
432 {
433 errorbox(ctr[TR_UNABLE_TO_MAKE_ROOT_FILESYSTEM]);
434 goto EXIT;
435 }
436
437 /* Mount harddisk. */
438 if (raid_disk)
439 snprintf(commandstring, STRING_SIZE, "/bin/mount %sp3 /harddisk", hdparams.devnode);
440 else
441 snprintf(commandstring, STRING_SIZE, "/bin/mount %s3 /harddisk", hdparams.devnode);
442 if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_ROOT_FILESYSTEM]))
443 {
444 errorbox(ctr[TR_UNABLE_TO_MOUNT_ROOT_FILESYSTEM]);
445 goto EXIT;
446 }
447
448 mkdir("/harddisk/boot", S_IRWXU|S_IRWXG|S_IRWXO);
449 mkdir("/harddisk/var", S_IRWXU|S_IRWXG|S_IRWXO);
450 mkdir("/harddisk/var/log", S_IRWXU|S_IRWXG|S_IRWXO);
451
452 if (raid_disk)
453 snprintf(commandstring, STRING_SIZE, "/bin/mount %sp1 /harddisk/boot", hdparams.devnode);
454 else
455 snprintf(commandstring, STRING_SIZE, "/bin/mount %s1 /harddisk/boot", hdparams.devnode);
456
457 if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_BOOT_FILESYSTEM]))
458 {
459 errorbox(ctr[TR_UNABLE_TO_MOUNT_BOOT_FILESYSTEM]);
460 goto EXIT;
461 }
462 if (swap_file) {
463 if (raid_disk)
464 snprintf(commandstring, STRING_SIZE, "/sbin/swapon %sp2", hdparams.devnode);
465 else
466 snprintf(commandstring, STRING_SIZE, "/sbin/swapon %s2", hdparams.devnode);
467 if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_SWAP_PARTITION]))
468 {
469 errorbox(ctr[TR_UNABLE_TO_MOUNT_SWAP_PARTITION]);
470 goto EXIT;
471 }
472 }
473 if (raid_disk)
474 snprintf(commandstring, STRING_SIZE, "/bin/mount %sp4 /harddisk/var", hdparams.devnode);
475 else
476 snprintf(commandstring, STRING_SIZE, "/bin/mount %s4 /harddisk/var", hdparams.devnode);
477 if (runcommandwithstatus(commandstring, ctr[TR_MOUNTING_LOG_FILESYSTEM]))
478 {
479 errorbox(ctr[TR_UNABLE_TO_MOUNT_LOG_FILESYSTEM]);
480 goto EXIT;
481 }
482
483 if (installtype == URL_INSTALL) {
484 snprintf(commandstring, STRING_SIZE,
485 "/bin/wget -q -O - %s/" SNAME "-" VERSION ".tbz2 | /bin/tar -C /harddisk -xvjf -", url);
486 }
487
488 if (installtype == CDROM_INSTALL) {
489 snprintf(commandstring, STRING_SIZE,
490 "/bin/tar -C /harddisk -xvjf /cdrom/" SNAME "-" VERSION ".tbz2");
491 }
492
493 if (runcommandwithprogress(60, 4, title, commandstring, INST_FILECOUNT,
494 ctr[TR_INSTALLING_FILES]))
495 {
496 errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]);
497 goto EXIT;
498 }
499
500 /* Save USB controller type to modules.conf */
501 write_usb_modules_conf();
502
503 /* touch the modules.dep files */
504 snprintf(commandstring, STRING_SIZE,
505 "/bin/touch /harddisk/lib/modules/%s-ipfire/modules.dep",
506 KERNEL_VERSION);
507 mysystem(commandstring);
508 snprintf(commandstring, STRING_SIZE,
509 "/bin/touch /harddisk/lib/modules/%s-ipfire-smp/modules.dep",
510 KERNEL_VERSION);
511 mysystem(commandstring);
512
513 /* Rename uname */
514 rename ("/harddisk/bin/uname.bak", "/harddisk/bin/uname");
515
516 /* mount proc filesystem */
517 mysystem("mkdir /harddisk/proc");
518 mysystem("/bin/mount -t proc none /harddisk/proc");
519 mysystem("/bin/mount --bind /dev /harddisk/dev");
520
521 /* Build cache lang file */
522 snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /usr/bin/perl -e \"require '" CONFIG_ROOT "/lang.pl'; &Lang::BuildCacheLang\"");
523 if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_LANG_CACHE]))
524 {
525 errorbox(ctr[TR_UNABLE_TO_INSTALL_LANG_CACHE]);
526 goto EXIT;
527 }
528
529 /* Update /etc/fstab */
530 replace("/harddisk/etc/fstab", "DEVICE", hdparams.devnode);
531
532 /* if we detected SCSI/USB then fixup */
533 mysystem("/bin/probecntrl.sh");
534 if ((handle = fopen("/tmp/cntrldriver", "r")))
535 {
536 char *driver;
537 fgets(line, STRING_SIZE-1, handle);
538 fclose(handle);
539 line[strlen(line) - 1] = 0;
540 driver = strtok(line, ".");
541 if (strlen(driver) > 1) {
542 fprintf(flog, "Fixing up ipfirerd.img\n");
543 mkdir("/harddisk/initrd", S_IRWXU|S_IRWXG|S_IRWXO);
544 snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitrd --with=scsi_mod %s --with=sd_mod --with=sr_mod /boot/ipfirerd.img %s-ipfire", driver, KERNEL_VERSION);
545 runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
546 snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitrd --with=scsi_mod %s --with=sd_mod --with=sr_mod /boot/ipfirerd-smp.img %s-ipfire-smp", driver, KERNEL_VERSION);
547 runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
548 mysystem("/sbin/chroot /harddisk /bin/mv /boot/grub/scsigrub.conf /boot/grub/grub.conf");
549 }
550 }
551
552 if (raid_disk)
553 sprintf(string, "root=%sp3", hdparams.devnode);
554 else
555 sprintf(string, "root=%s3", hdparams.devnode);
556 replace( "/harddisk/boot/grub/grub.conf", "root=ROOT", string);
557 replace( "/harddisk/boot/grub/grubbatch", "DEVICE", hdparams.devnode);
558
559 /* restore permissions */
560 chmod("/harddisk/boot/grub/grubbatch", S_IXUSR | S_IRUSR | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH);
561
562 snprintf(commandstring, STRING_SIZE,
563 "/sbin/chroot /harddisk /boot/grub/grubbatch");
564 if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_GRUB])) {
565 errorbox(ctr[TR_UNABLE_TO_INSTALL_GRUB]);
566 goto EXIT;
567 }
568
569 /* Install bootsplash */
570 mysystem("/bin/installbootsplash.sh");
571
572 mysystem("ln -s grub.conf /harddisk/boot/grub/menu.lst");
573 mysystem("umount /harddisk/proc");
574 mysystem("umount /harddisk/dev");
575
576 if (!unattended) {
577 sprintf(message, ctr[TR_CONGRATULATIONS_LONG],
578 NAME, SNAME, SNAME, NAME, NAME, NAME);
579 newtWinMessage(ctr[TR_CONGRATULATIONS], ctr[TR_OK], message);
580 }
581
582 allok = 1;
583
584 EXIT:
585 fprintf(flog, "Install program ended.\n");
586
587 if (!(allok))
588 newtWinMessage(title, ctr[TR_OK], ctr[TR_PRESS_OK_TO_REBOOT]);
589
590 freekeyvalues(ethernetkv);
591
592 if (allok && !allok_fastexit)
593 {
594 /* /proc is needed by the module checker. We have to mount it
595 * so it can be seen by setup, which is run chrooted. */
596 if (system("/bin/mount proc -t proc /harddisk/proc"))
597 printf("Unable to mount proc in /harddisk.");
598 else
599 {
600 if (unattended) {
601 fprintf(flog, "Entering unattended setup\n");
602 if (unattended_setup(unattendedkv)) {
603 snprintf(commandstring, STRING_SIZE, "/bin/sleep 10");
604 runcommandwithstatus(commandstring, "Unattended installation finished, system will reboot");
605 } else {
606 errorbox("Unattended setup failed.");
607 goto EXIT;
608 }
609 }
610
611 newtFinished();
612 fflush(flog);
613 fclose(flog);
614
615 if (!unattended) {
616 if (system("/sbin/chroot /harddisk /usr/local/sbin/setup /dev/tty2 INSTALL"))
617 printf("Unable to run setup.\n");
618 }
619
620 if (system("/bin/umount /harddisk/proc"))
621 printf("Unable to umount /harddisk/proc.\n");
622 }
623 }
624 fcloseall();
625
626 if (swap_file) {
627 if (raid_disk)
628 snprintf(commandstring, STRING_SIZE, "/bin/swapoff %sp2", hdparams.devnode);
629 else
630 snprintf(commandstring, STRING_SIZE, "/bin/swapoff %s2", hdparams.devnode);
631 }
632
633 newtFinished();
634
635 system("/bin/umount /harddisk/var");
636 system("/bin/umount /harddisk/boot");
637 system("/bin/umount /harddisk");
638
639 system("/etc/halt");
640
641 return 0;
642 }