1994-10-20 02:51:55 +00:00
|
|
|
/*
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
* "THE BEER-WARE LICENSE" (Revision 42):
|
|
|
|
* <phk@login.dkuug.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-17 23:36:49 +00:00
|
|
|
* $Id: main.c,v 1.16 1994/11/17 19:44:49 ache Exp $
|
1994-10-20 02:51:55 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1994-10-20 05:00:00 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <fcntl.h>
|
1994-11-11 23:22:56 +00:00
|
|
|
#include <signal.h>
|
1994-10-20 05:00:00 +00:00
|
|
|
|
|
|
|
#include <dialog.h>
|
|
|
|
|
|
|
|
#include <sys/ioctl.h>
|
1994-10-21 02:14:54 +00:00
|
|
|
#include <sys/reboot.h>
|
1994-10-20 05:00:00 +00:00
|
|
|
|
|
|
|
#define EXTERN /* only in main.c */
|
|
|
|
|
|
|
|
#include "sysinstall.h"
|
|
|
|
|
|
|
|
jmp_buf jmp_restart;
|
|
|
|
|
|
|
|
/*
|
Public apology:
I have walked all over Paul Richards code again, and severely lobotomized
some of his stuff, in order to cut some corners for the 2.0-Alpha release.
I belive that we can now manipulate fdisk and disklabel-stuff sufficiently
for the release to actually be produced.
It's not that I don't like Paul and his code, I just need something I
can kick out of the door RSN.
Sysinstall is now under absolute code-freeze, only Jordan has my permission
to commit to this code (stage0 & 5). I would appreciate if everybody
else would finds problems in sysinstall send patches to me, and I will
commit them. THANKYOU.
The fdisk/disklabel editors are made in pure ncurses, and follow a model
"a`la spreadsheet".
There are some important functions which are missing still, and I would
appreciate if somebody would look at them.
The FDISK part needs a "whole-disk" option, and it needs a "rewrite
MBR-boot code" option.
The DISKLABEL part needs to be able to "import DOS-partition".
Both need a "HELP" function, (display a file "/HELP" using dialog is OK).
It seems to me like the wd.c and sd.c should reread the physical record
when a DIOCGDINFO is made, so that they can pick up changes in the
MBR-data. Otherwise there will be a couple of weird cases where we
cannot avoid replicating code from the kernel.
If you want to play with this, look at src/release/Makefile. You may need
to step back to version 1.38 of sys/i386/isa/fd.c to make "rootable"
floppies, it is not clear at this time if that indeed is the problem I
have been having.
Sleep well, my friends, and expect the real Alpha in 24H, if the tree is
still solid.
1994-11-01 10:10:43 +00:00
|
|
|
* XXX: utils: Mkdir must do "-p".
|
|
|
|
* XXX: stage2: do mkdir for msdos-mounts.
|
|
|
|
* XXX: label: Import dos-slice.
|
|
|
|
* XXX: mbr: edit geometry
|
1994-10-20 05:00:00 +00:00
|
|
|
*/
|
|
|
|
|
1994-10-20 19:30:56 +00:00
|
|
|
extern int alloc_memory();
|
|
|
|
|
1994-11-11 23:22:56 +00:00
|
|
|
void
|
|
|
|
handle_intr(int sig)
|
|
|
|
{
|
1994-11-17 23:36:49 +00:00
|
|
|
dialog_clear_norefresh();
|
1994-11-11 23:22:56 +00:00
|
|
|
dialog_msgbox("User Interrupt",
|
|
|
|
"User interrupted. Aborting the installation",
|
1994-11-17 19:44:55 +00:00
|
|
|
-1, -1, 1);
|
1994-11-11 23:22:56 +00:00
|
|
|
ExitSysinstall();
|
|
|
|
}
|
|
|
|
|
1994-10-20 02:51:55 +00:00
|
|
|
int
|
1994-10-20 05:00:00 +00:00
|
|
|
main(int argc, char **argv)
|
1994-10-20 02:51:55 +00:00
|
|
|
{
|
1994-11-11 23:22:56 +00:00
|
|
|
signal(SIGINT, SIG_IGN);
|
|
|
|
|
1994-10-20 05:00:00 +00:00
|
|
|
/* Are we running as init? */
|
|
|
|
if (getpid() == 1) {
|
1994-11-08 18:44:14 +00:00
|
|
|
setsid();
|
1994-10-20 05:00:00 +00:00
|
|
|
close(0); open("/dev/console",O_RDWR);
|
|
|
|
close(1); dup(0);
|
|
|
|
close(2); dup(0);
|
1994-10-29 10:01:40 +00:00
|
|
|
printf("sysinstall running as init\n\r");
|
1994-11-08 18:44:14 +00:00
|
|
|
ioctl(0,TIOCSCTTY,(char *)NULL);
|
1994-10-20 05:00:00 +00:00
|
|
|
setlogin("root");
|
Public apology:
I have walked all over Paul Richards code again, and severely lobotomized
some of his stuff, in order to cut some corners for the 2.0-Alpha release.
I belive that we can now manipulate fdisk and disklabel-stuff sufficiently
for the release to actually be produced.
It's not that I don't like Paul and his code, I just need something I
can kick out of the door RSN.
Sysinstall is now under absolute code-freeze, only Jordan has my permission
to commit to this code (stage0 & 5). I would appreciate if everybody
else would finds problems in sysinstall send patches to me, and I will
commit them. THANKYOU.
The fdisk/disklabel editors are made in pure ncurses, and follow a model
"a`la spreadsheet".
There are some important functions which are missing still, and I would
appreciate if somebody would look at them.
The FDISK part needs a "whole-disk" option, and it needs a "rewrite
MBR-boot code" option.
The DISKLABEL part needs to be able to "import DOS-partition".
Both need a "HELP" function, (display a file "/HELP" using dialog is OK).
It seems to me like the wd.c and sd.c should reread the physical record
when a DIOCGDINFO is made, so that they can pick up changes in the
MBR-data. Otherwise there will be a couple of weird cases where we
cannot avoid replicating code from the kernel.
If you want to play with this, look at src/release/Makefile. You may need
to step back to version 1.38 of sys/i386/isa/fd.c to make "rootable"
floppies, it is not clear at this time if that indeed is the problem I
have been having.
Sleep well, my friends, and expect the real Alpha in 24H, if the tree is
still solid.
1994-11-01 10:10:43 +00:00
|
|
|
debug_fd = open("/dev/ttyv1",O_WRONLY);
|
|
|
|
} else {
|
|
|
|
debug_fd = open("sysinstall.debug",
|
|
|
|
O_WRONLY|O_CREAT|O_TRUNC,0644);
|
1994-10-20 05:00:00 +00:00
|
|
|
}
|
|
|
|
if (set_termcap() == -1) {
|
|
|
|
Fatal("Can't find terminal entry\n");
|
|
|
|
}
|
|
|
|
/* XXX too early to use fatal ! */
|
|
|
|
|
|
|
|
/* XXX - libdialog has particularly bad return value checking */
|
|
|
|
init_dialog();
|
|
|
|
/* If we haven't crashed I guess dialog is running ! */
|
|
|
|
dialog_active = 1;
|
|
|
|
|
1994-11-11 23:22:56 +00:00
|
|
|
signal(SIGINT, handle_intr);
|
|
|
|
|
1994-10-20 19:30:56 +00:00
|
|
|
if (alloc_memory() < 0)
|
|
|
|
Fatal("No memory\n");
|
|
|
|
|
1994-11-06 04:05:45 +00:00
|
|
|
if (getpid() != 1) {
|
|
|
|
stage0();
|
|
|
|
stage1();
|
1994-11-06 04:34:46 +00:00
|
|
|
end_dialog();
|
|
|
|
dialog_active=0;
|
1994-11-06 04:05:45 +00:00
|
|
|
} else if (!access("/this_is_boot_flp",R_OK)) {
|
1994-11-12 05:40:28 +00:00
|
|
|
while(1) {
|
|
|
|
stage0();
|
|
|
|
if(!stage1())
|
|
|
|
break;
|
|
|
|
}
|
1994-10-20 05:00:00 +00:00
|
|
|
stage2();
|
1994-11-06 04:05:45 +00:00
|
|
|
end_dialog();
|
|
|
|
dialog_active=0;
|
1994-10-21 02:14:54 +00:00
|
|
|
reboot(RB_AUTOBOOT);
|
1994-10-20 06:14:29 +00:00
|
|
|
} else {
|
1994-10-26 02:53:15 +00:00
|
|
|
stage3();
|
|
|
|
stage4();
|
|
|
|
stage5();
|
1994-10-20 06:48:40 +00:00
|
|
|
}
|
1994-10-20 02:51:55 +00:00
|
|
|
return 0;
|
|
|
|
}
|