Deleted Added
full compact
system.c (26200) system.c (27798)
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: system.c,v 1.80 1997/04/28 10:31:14 jkh Exp $
7 * $Id: system.c,v 1.81 1997/05/27 18:56:03 jkh Exp $
8 *
9 * Jordan Hubbard
10 *
11 * My contributions are in the public domain.
12 *
13 * Parts of this file are also blatently stolen from Poul-Henning Kamp's
14 * previous version of sysinstall, and as such fall under his "BEERWARE license"
15 * so buy him a beer if you like it! Buy him a beer for me, too!

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

64{
65 int i;
66
67 signal(SIGINT, SIG_IGN);
68 globalsInit();
69
70 /* Are we running as init? */
71 if (getpid() == 1) {
8 *
9 * Jordan Hubbard
10 *
11 * My contributions are in the public domain.
12 *
13 * Parts of this file are also blatently stolen from Poul-Henning Kamp's
14 * previous version of sysinstall, and as such fall under his "BEERWARE license"
15 * so buy him a beer if you like it! Buy him a beer for me, too!

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

64{
65 int i;
66
67 signal(SIGINT, SIG_IGN);
68 globalsInit();
69
70 /* Are we running as init? */
71 if (getpid() == 1) {
72 int fd, type;
73
74 RunningAsInit = 1;
72 setsid();
73 close(0);
75 setsid();
76 close(0);
74 if (open("/dev/ttyv0", O_RDWR) < 0)
75 open("/dev/console", O_RDWR);
77 fd = open("/dev/ttyv0", O_RDWR);
78 if (fd == -1)
79 fd = open("/dev/console", O_RDWR); /* fallback */
76 else
77 OnVTY = TRUE;
80 else
81 OnVTY = TRUE;
82 /*
83 * To make _sure_ we're on a VTY and don't have /dev/console switched
84 * away to a serial port or something, attempt to set the cursor appearance.
85 */
86 type = 0; /* normal */
87 if (OnVTY) {
88 int fd2;
89
90 if ((fd2 = open("/dev/console", O_RDWR)) != -1) {
91 if (ioctl(fd2, CONS_CURSORTYPE, &type) == -1) {
92 OnVTY = FALSE;
93 close(fd); close(fd2);
94 open("/dev/console", O_RDWR);
95 }
96 else
97 close(fd2);
98 }
99 }
78 close(1); dup(0);
79 close(2); dup(0);
100 close(1); dup(0);
101 close(2); dup(0);
80 printf("%s running as init\n", argv[0]);
81 RunningAsInit = 1;
102 printf("%s running as init on %s\n", argv[0], OnVTY ? "vty0" : "serial console");
82 i = ioctl(0, TIOCSCTTY, (char *)NULL);
83 setlogin("root");
84 setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/usr/bin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin:/usr/X11R6/bin", 1);
85 setbuf(stdin, 0);
86 setbuf(stderr, 0);
87 }
88 else {
89 char hname[256];

--- 266 unchanged lines hidden ---
103 i = ioctl(0, TIOCSCTTY, (char *)NULL);
104 setlogin("root");
105 setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/usr/bin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin:/usr/X11R6/bin", 1);
106 setbuf(stdin, 0);
107 setbuf(stderr, 0);
108 }
109 else {
110 char hname[256];

--- 266 unchanged lines hidden ---