summaryrefslogtreecommitdiffstats
path: root/sbin/sysinstall
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1995-01-30 03:19:58 +0000
committerphk <phk@FreeBSD.org>1995-01-30 03:19:58 +0000
commit5da6d72e0b01c1c10379d336f96e65d68c25bdcb (patch)
treec0883d4800aeb5c982d4676b5e733fdea40682e0 /sbin/sysinstall
parentde932de1a996293e5b1a6c53e805bee75e524ae2 (diff)
downloadFreeBSD-src-5da6d72e0b01c1c10379d336f96e65d68c25bdcb.zip
FreeBSD-src-5da6d72e0b01c1c10379d336f96e65d68c25bdcb.tar.gz
Move the real kernel onto the cpio.flp and read this from the boot.flp
make debug handling with serial console obnoxious, but present.
Diffstat (limited to 'sbin/sysinstall')
-rw-r--r--sbin/sysinstall/main.c6
-rw-r--r--sbin/sysinstall/stage2.c79
-rw-r--r--sbin/sysinstall/stage4.c62
-rw-r--r--sbin/sysinstall/termcap.c8
4 files changed, 79 insertions, 76 deletions
diff --git a/sbin/sysinstall/main.c b/sbin/sysinstall/main.c
index e9433e4..5e4b8f0 100644
--- a/sbin/sysinstall/main.c
+++ b/sbin/sysinstall/main.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: main.c,v 1.18 1994/12/27 23:26:51 jkh Exp $
+ * $Id: main.c,v 1.19 1995/01/29 02:31:35 phk Exp $
*
*/
@@ -60,13 +60,9 @@ main(int argc, char **argv)
printf("sysinstall running as init\n\r");
ioctl(0,TIOCSCTTY,(char *)NULL);
setlogin("root");
- debug_fd = open("/dev/ttyv1",O_WRONLY);
setbuf(stdin,0);
setbuf(stdout,0);
setbuf(stderr,0);
- } else {
- debug_fd = open("sysinstall.debug",
- O_WRONLY|O_CREAT|O_TRUNC,0644);
}
if (set_termcap() == -1) {
Fatal("Can't find terminal entry\n");
diff --git a/sbin/sysinstall/stage2.c b/sbin/sysinstall/stage2.c
index 03c2867..b801c29 100644
--- a/sbin/sysinstall/stage2.c
+++ b/sbin/sysinstall/stage2.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: stage2.c,v 1.20 1994/12/27 23:26:56 jkh Exp $
+ * $Id: stage2.c,v 1.21 1995/01/14 10:31:21 jkh Exp $
*
*/
@@ -89,9 +89,6 @@ stage2()
TellEm("unzipping /stand/sysinstall onto hard disk");
exec(4, "/stand/gzip", "zcat", 0 );
-/*
- CopyFile("/stand/sysinstall","/mnt/stand/sysinstall");
-*/
Link("/mnt/stand/sysinstall","/mnt/stand/cpio");
Link("/mnt/stand/sysinstall","/mnt/stand/bad144");
Link("/mnt/stand/sysinstall","/mnt/stand/gunzip");
@@ -125,7 +122,6 @@ stage2()
}
}
- CopyFile("/kernel","/mnt/kernel");
TellEm("make /dev entries");
chdir("/mnt/dev");
makedevs();
@@ -152,11 +148,76 @@ stage2()
fprintf(f1,"proc\t\t/proc\tprocfs rw 0 0\n");
fclose(f1);
+#if 1
+{
+#include <sys/wait.h>
+
+ int ffd, pfd[2];
+ int zpid, cpid;
+ int i,j,k;
+
+ j = fork();
+ if (!j) {
+ chroot("/mnt");
+ chdir("/");
+ retry:
+ while (1) {
+ dialog_msgbox(TITLE,
+ "Insert CPIO floppy in floppy drive 0", -1, -1, 1);
+ ffd = open("/dev/rfd0",O_RDONLY);
+ if (ffd > 0)
+ break;
+ Debug("problems opening /dev/rfd0: %d",errno);
+ }
+ dialog_clear_norefresh();
+ TellEm("cd /stand ; gunzip < /dev/fd0 | cpio -idum");
+ pipe(pfd);
+ zpid = fork();
+ if (!zpid) {
+ close(0); dup(ffd); close(ffd);
+ close(1); dup(pfd[1]); close(pfd[1]);
+ close(pfd[0]);
+ i = exec (1,"/stand/gunzip","/stand/gunzip", 0);
+ exit(i);
+ }
+ cpid = fork();
+ if (!cpid) {
+ close(0); dup(pfd[0]); close(pfd[0]);
+ close(ffd);
+ close(pfd[1]);
+ close(1); open("/dev/null",O_WRONLY);
+ chdir("/stand");
+ i = exec (1,"/stand/cpio","/stand/cpio","-iduvm", 0);
+ exit(i);
+ }
+ close(pfd[0]);
+ close(pfd[1]);
+ close(ffd);
+ i = wait(&j);
+ if (i < 0 || j)
+ Fatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s",
+ i, j, cpid, zpid, strerror(errno));
+ i = wait(&j);
+ if (i < 0 || j)
+ Fatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s",
+ i, j, cpid, zpid, strerror(errno));
+
+ /* bininst.sh MUST be the last file on the floppy */
+ if (access("/stand/OK", R_OK) == -1) {
+ AskAbort("CPIO floppy was bad! Please check media for defects and retry.");
+ goto retry;
+ }
+ unlink("/stand/OK");
+ i = rename ("/stand/kernel","/kernel");
+ exit (i);
+ }
+ i = wait(&k);
+ Debug("chroot'er: %d %d %d",i,j,k);
+}
+
+#endif
+
sync();
- TellEm("Make marker file");
- i = open("/mnt/stand/need_cpio_floppy",O_CREAT|O_WRONLY|O_TRUNC);
- close(i);
-
TellEm("Unmount disks");
for (j = 1; Fsize[j]; j++)
continue;
diff --git a/sbin/sysinstall/stage4.c b/sbin/sysinstall/stage4.c
index 5ec5a4f..4f127ac 100644
--- a/sbin/sysinstall/stage4.c
+++ b/sbin/sysinstall/stage4.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: stage4.c,v 1.11 1995/01/14 10:31:23 jkh Exp $
+ * $Id: stage4.c,v 1.12 1995/01/28 01:13:28 jkh Exp $
*
*/
@@ -27,62 +27,4 @@
#include "sysinstall.h"
void
-stage4()
-{
- int ffd, pfd[2];
- int zpid, cpid;
- int i,j;
-
- if (access("/stand/need_cpio_floppy",R_OK))
- return;
-retry:
- while (1) {
- dialog_msgbox(TITLE,
- "Insert CPIO floppy in floppy drive 0", -1, -1, 1);
- ffd = open("/dev/fd0a",O_RDONLY);
- if (ffd > 0)
- break;
- }
- dialog_clear_norefresh();
- TellEm("cd /stand ; gunzip < /dev/fd0 | cpio -idum");
- pipe(pfd);
- zpid = fork();
- if (!zpid) {
- close(0); dup(ffd); close(ffd);
- close(1); dup(pfd[1]); close(pfd[1]);
- close(pfd[0]);
- i = exec (1,"/stand/gunzip","/stand/gunzip", 0);
- exit(i);
- }
- cpid = fork();
- if (!cpid) {
- close(0); dup(pfd[0]); close(pfd[0]);
- close(ffd);
- close(pfd[1]);
- close(1); open("/dev/null",O_WRONLY);
- chdir("/stand");
- i = exec (1,"/stand/cpio","/stand/cpio","-iduvm", 0);
- exit(i);
- }
- close(pfd[0]);
- close(pfd[1]);
- close(ffd);
- i = wait(&j);
- if (i < 0 || j)
- Fatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s",
- i, j, cpid, zpid, strerror(errno));
- i = wait(&j);
- if (i < 0 || j)
- Fatal("Pid %d, status %d, cpio=%d, gunzip=%d.\nerror:%s",
- i, j, cpid, zpid, strerror(errno));
-
- /* bininst.sh MUST be the last file on the floppy */
- if (access("/stand/scripts/bininst.sh", R_OK) == -1) {
- AskAbort("CPIO floppy was bad! Please check media for defects and retry.");
- goto retry;
- }
- else {
- TellEm("unlink /stand/need_cpio_floppy");
- unlink("/stand/need_cpio_floppy");
- }
-}
+stage4() { /* Obsolete */ }
diff --git a/sbin/sysinstall/termcap.c b/sbin/sysinstall/termcap.c
index d3e5010..80f538a 100644
--- a/sbin/sysinstall/termcap.c
+++ b/sbin/sysinstall/termcap.c
@@ -38,19 +38,23 @@ set_termcap()
return -1;
if (setenv("TERMCAP", termcap_vt100, 1) < 0)
return -1;
+ debug_fd = dup(1);
} else if (color_display) {
if (setenv("TERM", "cons25", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25, 1) < 0)
return -1;
+ debug_fd = open("/dev/ttyv1",O_WRONLY);
} else {
if (setenv("TERM", "cons25-m", 1) < 0)
return -1;
if (setenv("TERMCAP", termcap_cons25_m, 1) < 0)
return -1;
+ debug_fd = open("/dev/ttyv1",O_WRONLY);
}
+ } else {
+ debug_fd = open("sysinstall.debug",
+ O_WRONLY|O_CREAT|O_TRUNC,0644);
}
- printf("TERM=%s\n",getenv("TERM"));
- printf("TERMCAP=%s\n",getenv("TERMCAP"));
return 0;
}
OpenPOWER on IntegriCloud