Deleted Added
full compact
install.c (8825) install.c (8837)
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last program in the `sysinstall' line - the next
5 * generation being essentially a complete rewrite.
6 *
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last program in the `sysinstall' line - the next
5 * generation being essentially a complete rewrite.
6 *
7 * $Id: install.c,v 1.65 1995/05/28 23:12:05 jkh Exp $
7 * $Id: install.c,v 1.66 1995/05/29 00:50:02 jkh Exp $
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 233 unchanged lines hidden (view full) ---

249
250 /* Tack ourselves at the end of /etc/hosts */
251 if (RunningAsInit && getenv(VAR_IPADDR) && !hostsModified) {
252 fp = fopen("/etc/hosts", "a");
253 fprintf(fp, "%s\t\t%s\n", getenv(VAR_IPADDR), getenv(VAR_HOSTNAME));
254 fclose(fp);
255 hostsModified = TRUE;
256 }
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 233 unchanged lines hidden (view full) ---

249
250 /* Tack ourselves at the end of /etc/hosts */
251 if (RunningAsInit && getenv(VAR_IPADDR) && !hostsModified) {
252 fp = fopen("/etc/hosts", "a");
253 fprintf(fp, "%s\t\t%s\n", getenv(VAR_IPADDR), getenv(VAR_HOSTNAME));
254 fclose(fp);
255 hostsModified = TRUE;
256 }
257 /* If there's no kernel but there is a kernel.GENERIC, link it over */
258 if (access("/kernel", R_OK))
259 vsystem("ln -f /kernel.GENERIC /kernel");
260
257 msgConfirm("Installation completed successfully.\nHit return now to go back to the main menu.");
258 SystemWasInstalled = TRUE;
259 return 0;
260}
261
262/* Go newfs and/or mount all the filesystems we've been asked to */
263static void
264make_filesystems(void)

--- 109 unchanged lines hidden (view full) ---

374 int i;
375
376 msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem");
377 i = vsystem("find -x /stand | cpio -pdmV /mnt");
378 if (i)
379 msgConfirm("Copy returned error status of %d!", i);
380
381 /* Copy the /etc files into their rightful place */
261 msgConfirm("Installation completed successfully.\nHit return now to go back to the main menu.");
262 SystemWasInstalled = TRUE;
263 return 0;
264}
265
266/* Go newfs and/or mount all the filesystems we've been asked to */
267static void
268make_filesystems(void)

--- 109 unchanged lines hidden (view full) ---

378 int i;
379
380 msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem");
381 i = vsystem("find -x /stand | cpio -pdmV /mnt");
382 if (i)
383 msgConfirm("Copy returned error status of %d!", i);
384
385 /* Copy the /etc files into their rightful place */
382 (void)vsystem("(cd /stand; find etc) | cpio -pdmv /mnt");
386 (void)vsystem("cd /mnt/stand; find etc | cpio -pdmv /mnt");
383}
384
385static void loop_on_root_floppy();
386
387static void
388root_extract(void)
389{
390 int fd;
391
392 if (OnCDROM) {
393 fd = open("/floppies/root.flp", O_RDONLY);
387}
388
389static void loop_on_root_floppy();
390
391static void
392root_extract(void)
393{
394 int fd;
395
396 if (OnCDROM) {
397 fd = open("/floppies/root.flp", O_RDONLY);
394 (void)mediaExtractDist("root.flp", "/", fd);
398 (void)mediaExtractDist("/", fd);
395 return;
396 }
397 if (mediaDevice) {
398 switch(mediaDevice->type) {
399
400 case DEVICE_TYPE_DOS:
401 case DEVICE_TYPE_FTP:
402 case DEVICE_TYPE_DISK:
403 case DEVICE_TYPE_NETWORK:
404 case DEVICE_TYPE_CDROM:
405 if (mediaDevice->init)
406 if (!(*mediaDevice->init)(mediaDevice))
407 break;
408 fd = (*mediaDevice->get)("floppies/root.flp");
409 if (fd != -1) {
410 msgNotify("Loading root floppy from %s", mediaDevice->name);
399 return;
400 }
401 if (mediaDevice) {
402 switch(mediaDevice->type) {
403
404 case DEVICE_TYPE_DOS:
405 case DEVICE_TYPE_FTP:
406 case DEVICE_TYPE_DISK:
407 case DEVICE_TYPE_NETWORK:
408 case DEVICE_TYPE_CDROM:
409 if (mediaDevice->init)
410 if (!(*mediaDevice->init)(mediaDevice))
411 break;
412 fd = (*mediaDevice->get)("floppies/root.flp");
413 if (fd != -1) {
414 msgNotify("Loading root floppy from %s", mediaDevice->name);
411 (void)mediaExtractDist("root.flp", "/", fd);
415 (void)mediaExtractDist("/", fd);
412 if (mediaDevice->close)
413 (*mediaDevice->close)(mediaDevice, fd);
414 else
415 close(fd);
416 if (mediaDevice->shutdown)
417 (*mediaDevice->shutdown)(mediaDevice);
418 } else {
416 if (mediaDevice->close)
417 (*mediaDevice->close)(mediaDevice, fd);
418 else
419 close(fd);
420 if (mediaDevice->shutdown)
421 (*mediaDevice->shutdown)(mediaDevice);
422 } else {
423 msgConfirm("Couldn't get root floppy image from %s\n, falling back to floppy.", mediaDevice->name);
419 if (mediaDevice->shutdown)
420 (*mediaDevice->shutdown)(mediaDevice);
421 loop_on_root_floppy();
422 }
423 break;
424
424 if (mediaDevice->shutdown)
425 (*mediaDevice->shutdown)(mediaDevice);
426 loop_on_root_floppy();
427 }
428 break;
429
430 case DEVICE_TYPE_TAPE:
425 case DEVICE_TYPE_FLOPPY:
426 default:
427 loop_on_root_floppy();
428 break;
429 }
430 }
431 else
432 loop_on_root_floppy();
433}
434
435static void
436loop_on_root_floppy(void)
437{
438 int fd;
439
431 case DEVICE_TYPE_FLOPPY:
432 default:
433 loop_on_root_floppy();
434 break;
435 }
436 }
437 else
438 loop_on_root_floppy();
439}
440
441static void
442loop_on_root_floppy(void)
443{
444 int fd;
445
440 fd = getRootFloppy();
441 if (fd != -1)
442 mediaExtractDist("root.flp", "/", fd);
446 while (1) {
447 fd = getRootFloppy();
448 if (fd != -1) {
449 mediaExtractDist("/", fd);
450 break;
451 }
452 }
443}
453}