1994-10-26 02:53:15 +00:00
|
|
|
/*
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
* "THE BEER-WARE LICENSE" (Revision 42):
|
|
|
|
* <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
|
|
|
|
* can do whatever you want with this stuff. If we meet some day, and you think
|
|
|
|
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
*
|
1994-11-02 07:15:56 +00:00
|
|
|
* $Id: stage4.c,v 1.4 1994/11/02 06:19:49 jkh Exp $
|
1994-10-26 02:53:15 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <dialog.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
|
|
|
#include "sysinstall.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
stage4()
|
|
|
|
{
|
1994-11-02 06:19:53 +00:00
|
|
|
int ffd, pfd[2];
|
|
|
|
int zpid, cpid;
|
|
|
|
int i,j;
|
1994-10-26 02:53:15 +00:00
|
|
|
|
1994-11-02 06:19:53 +00:00
|
|
|
if (access("/stand/need_cpio_floppy",R_OK))
|
|
|
|
return;
|
1994-10-26 02:53:15 +00:00
|
|
|
|
1994-11-02 06:19:53 +00:00
|
|
|
while (1) {
|
|
|
|
dialog_msgbox(TITLE,
|
|
|
|
"Insert CPIO floppy in floppy drive 0", 6, 75, 1);
|
|
|
|
ffd = open("/dev/fd0a",O_RDONLY);
|
|
|
|
if (ffd > 0)
|
|
|
|
break;
|
|
|
|
}
|
1994-11-02 07:15:56 +00:00
|
|
|
dialog_clear();
|
1994-11-02 06:19:53 +00:00
|
|
|
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]);
|
1994-10-26 02:53:15 +00:00
|
|
|
close(pfd[0]);
|
1994-11-02 06:19:53 +00:00
|
|
|
i = exec (1,"/stand/gunzip","/stand/gunzip", 0);
|
|
|
|
exit(i);
|
|
|
|
}
|
|
|
|
cpid = fork();
|
|
|
|
if (!cpid) {
|
|
|
|
close(0); dup(pfd[0]); close(pfd[0]);
|
1994-10-26 02:53:15 +00:00
|
|
|
close(ffd);
|
1994-11-02 06:19:53 +00:00
|
|
|
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));
|
|
|
|
|
|
|
|
TellEm("unlink /stand/need_cpio_floppy");
|
|
|
|
unlink("/stand/need_cpio_floppy");
|
1994-10-26 02:53:15 +00:00
|
|
|
}
|