1994-10-20 06:00:00 +01:00
/*
# define DEBUG
* Copyright ( c ) 1994 , Paul Richards .
*
* All rights reserved .
*
* This software may be used , modified , copied , distributed , and
* sold , in both source and binary form provided that the above
* copyright and these terms are retained , verbatim , as the first
* lines of this file . Under no circumstances is the author
* responsible for the proper functioning of this software , nor does
* the author assume any responsibility for damages incurred with
* its use .
*/
# include <dialog.h>
# include <fcntl.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <unistd.h>
# include <stdarg.h>
# include <sys/types.h>
# include <sys/errno.h>
# include <sys/disklabel.h>
# include <sys/ioctl.h>
# include <sys/param.h>
# include <sys/stat.h>
# include <ufs/ffs/fs.h>
# include <machine/console.h>
# include "mbr.h"
# include "sysinstall.h"
1994-10-29 13:03:59 +01:00
# include "bootarea.h"
1994-10-20 06:00:00 +01:00
struct disklabel * avail_disklabels ;
int * avail_fds ;
unsigned char * * options ;
unsigned char * * avail_disknames ;
unsigned char * scratch ;
unsigned char * errmsg ;
unsigned char * bootblocks ;
struct mbr * mbr ;
int no_disks = 0 ;
int inst_disk = 0 ;
int inst_part = 0 ;
1994-10-21 19:08:33 +01:00
int whole_disk = 0 ;
int custom_install = 0 ;
1994-10-20 06:00:00 +01:00
int dialog_active = 0 ;
void exit_sysinstall ( ) ;
void exit_prompt ( ) ;
extern char * part_type ( int ) ;
char selection [ 30 ] ;
1994-10-21 19:08:33 +01:00
char boot1 [ ] = BOOT1 ;
char boot2 [ ] = BOOT2 ;
1994-10-20 06:00:00 +01:00
int
alloc_memory ( )
{
int i ;
scratch = ( char * ) calloc ( SCRATCHSIZE , sizeof ( char ) ) ;
if ( ! scratch )
return ( - 1 ) ;
errmsg = ( char * ) calloc ( ERRMSGSIZE , sizeof ( char ) ) ;
if ( ! errmsg )
return ( - 1 ) ;
avail_disklabels = ( struct disklabel * ) calloc ( MAX_NO_DISKS , sizeof ( struct disklabel ) ) ;
if ( ! avail_disklabels )
return ( - 1 ) ;
avail_fds = ( int * ) calloc ( MAX_NO_DISKS , sizeof ( int ) ) ;
if ( ! avail_fds )
return ( - 1 ) ;
avail_disknames = ( unsigned char * * ) calloc ( MAX_NO_DISKS , sizeof ( char * ) ) ;
if ( ! avail_disknames )
return ( - 1 ) ;
for ( i = 0 ; i < MAX_NO_DISKS ; i + + ) {
avail_disknames [ i ] = ( char * ) calloc ( 15 , sizeof ( char ) ) ;
if ( ! avail_disknames [ i ] )
return ( - 1 ) ;
}
options = ( unsigned char * * ) calloc ( MAX_NO_DISKS , sizeof ( char * ) ) ;
if ( ! options )
return ( - 1 ) ;
for ( i = 0 ; i < MAX_NO_DISKS ; i + + ) {
options [ i ] = ( char * ) calloc ( 100 , sizeof ( char ) ) ;
if ( ! options [ i ] )
return ( - 1 ) ;
}
mbr = ( struct mbr * ) malloc ( sizeof ( struct mbr ) ) ;
if ( ! mbr )
return ( - 1 ) ;
bootblocks = ( char * ) malloc ( BBSIZE ) ;
if ( ! bootblocks )
return ( - 1 ) ;
return ( 0 ) ;
}
void
free_memory ( )
{
int i ;
free ( scratch ) ;
free ( errmsg ) ;
free ( avail_disklabels ) ;
free ( avail_fds ) ;
for ( i = 0 ; i < MAX_NO_DISKS ; i + + )
free ( avail_disknames [ i ] ) ;
free ( avail_disknames ) ;
for ( i = 0 ; i < MAX_NO_DISKS ; i + + )
free ( options [ i ] ) ;
free ( options ) ;
free ( mbr ) ;
free ( bootblocks ) ;
}
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 11:10:43 +01:00
char * device_list [ ] = { " wd " , " sd " , 0 } ;
1994-10-20 06:00:00 +01:00
void
query_disks ( )
{
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 11:10:43 +01:00
int i , j ;
char disk [ 15 ] ;
char diskname [ 5 ] ;
struct stat st ;
struct disklabel dl ;
int fd ;
for ( i = 0 ; i < MAX_NO_DISKS ; i + + )
if ( Dname [ i ] ) {
close ( Dfd [ i ] ) ; Dfd [ i ] = 0 ;
free ( Dlbl [ i ] ) ; Dlbl [ i ] = 0 ;
free ( Dname [ i ] ) ; Dname [ i ] = 0 ;
1994-10-20 06:00:00 +01:00
}
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 11:10:43 +01:00
Ndisk = 0 ;
for ( j = 0 ; device_list [ j ] ; j + + ) {
1994-10-20 06:00:00 +01:00
for ( i = 0 ; i < 10 ; i + + ) {
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 11:10:43 +01:00
sprintf ( diskname , " %s%d " , device_list [ j ] , i ) ;
sprintf ( disk , " /dev/r%sd " , diskname ) ;
if ( stat ( disk , & st ) | | ! ( st . st_mode & S_IFCHR ) )
continue ;
if ( ( fd = open ( disk , O_RDWR ) ) = = - 1 )
continue ;
if ( ioctl ( fd , DIOCGDINFO , & dl ) = = - 1 ) {
close ( fd ) ;
continue ;
}
Dlbl [ Ndisk ] = Malloc ( sizeof dl ) ;
memcpy ( Dlbl [ Ndisk ] , & dl , sizeof dl ) ;
Dname [ Ndisk ] = StrAlloc ( diskname ) ;
Dfd [ Ndisk ] = fd ;
Ndisk + + ;
if ( Ndisk = = MAX_NO_DISKS )
return ;
1994-10-20 06:00:00 +01:00
}
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 11:10:43 +01:00
}
1994-10-20 06:00:00 +01:00
}
int
select_disk ( )
{
int i ;
int valid ;
do {
valid = 1 ;
sprintf ( scratch , " There are %d disks available for installation: " , no_disks ) ;
for ( i = 0 ; i < no_disks ; i + + ) {
sprintf ( options [ ( i * 2 ) ] , " %d " , i + 1 ) ;
1994-10-26 05:09:19 +01:00
sprintf ( options [ ( i * 2 ) + 1 ] , " %s, (%dMb) -> %s " , avail_disklabels [ i ] . d_typename , disk_size ( & avail_disklabels [ i ] ) , avail_disknames [ i ] ) ;
1994-10-20 06:00:00 +01:00
}
if ( dialog_menu ( " FreeBSD Installation " , scratch , 10 , 75 , 5 , no_disks , options , selection ) ) {
1994-10-21 19:08:33 +01:00
dialog_clear ( ) ;
sprintf ( scratch , " \n \n \n You did not select a valid disk. \n \n " ) ;
1994-10-20 06:00:00 +01:00
AskAbort ( scratch ) ;
valid = 0 ;
}
1994-10-20 20:30:56 +01:00
dialog_clear ( ) ;
1994-10-20 06:00:00 +01:00
} while ( ! valid ) ;
return ( atoi ( selection ) - 1 ) ;
}
int
select_partition ( int disk )
{
int valid ;
int i ;
int choice ;
do {
valid = 1 ;
1994-10-26 05:09:19 +01:00
whole_disk = 0 ;
1994-10-20 06:00:00 +01:00
sprintf ( scratch , " Select one of the following areas to install to: " ) ;
sprintf ( options [ 0 ] , " %d " , 0 ) ;
sprintf ( options [ 1 ] , " %s, (%dMb) " , " Install to entire disk " ,
1994-10-26 05:09:19 +01:00
disk_size ( & avail_disklabels [ inst_disk ] ) ) ;
1994-10-20 06:00:00 +01:00
for ( i = 0 ; i < NDOSPART ; i + + ) {
sprintf ( options [ ( i * 2 ) + 2 ] , " %d " , i + 1 ) ;
sprintf ( options [ ( i * 2 ) + 3 ] , " %s, (%ldMb) " ,
part_type ( mbr - > dospart [ i ] . dp_typ ) ,
mbr - > dospart [ i ] . dp_size * 512 / ( 1024 * 1024 ) ) ;
}
if ( dialog_menu ( TITLE ,
scratch , 10 , 75 , 5 , 5 , options , selection ) ) {
sprintf ( scratch , " You did not select a valid partition " ) ;
1994-10-21 19:08:33 +01:00
dialog_clear ( ) ;
1994-10-20 06:00:00 +01:00
AskAbort ( scratch ) ;
valid = 0 ;
}
1994-10-20 20:30:56 +01:00
dialog_clear ( ) ;
1994-10-21 19:08:33 +01:00
choice = atoi ( selection ) - 1 ;
if ( choice = = - 1 ) {
whole_disk = 1 ;
choice = 0 ;
if ( dialog_yesno ( TITLE , " \n \n Installing to the whole disk will erase all its current data. \n \n Are you sure you want to do this? " , 10 , 75 ) ) {
1994-10-20 06:00:00 +01:00
valid = 0 ;
1994-10-21 19:08:33 +01:00
whole_disk = 0 ;
}
}
1994-10-20 20:30:56 +01:00
dialog_clear ( ) ;
1994-10-20 06:00:00 +01:00
} while ( ! valid ) ;
1994-10-21 19:08:33 +01:00
return ( choice ) ;
1994-10-20 06:00:00 +01:00
}
void
stage1 ( )
{
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 11:10:43 +01:00
int i , j ;
1994-10-20 06:00:00 +01:00
int ok = 0 ;
int ready = 0 ;
1994-10-21 19:08:33 +01:00
query_disks ( ) ;
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 11:10:43 +01:00
while ( ! ready ) {
clear ( ) ; standend ( ) ;
j = 0 ;
mvprintw ( j + + , 0 , " %s -- Diskspace editor " , TITLE ) ;
j + + ;
mvprintw ( j + + , 0 , " Disks Total FreeBSD " ) ;
j + + ;
for ( i = 0 ; i < MAX_NO_DISKS ; i + + ) {
if ( ! Dname [ i ] )
continue ;
mvprintw ( j + + , 0 , " %2d: %-6s %5lu MB %5lu MB " ,
i ,
Dname [ i ] ,
PartMb ( Dlbl [ i ] , RAWPART ) ,
PartMb ( Dlbl [ i ] , OURPART ) ) ;
}
j + + ;
mvprintw ( j + + , 0 , " Filesystems Type Size Mountpoint " ) ;
j + + ;
for ( i = 0 ; i < MAX_NO_FS ; i + + ) {
if ( ! Fname [ i ] )
continue ;
mvprintw ( j + + , 0 , " %2d: %-5s %-5s %5lu MB %-s " ,
i , Fname [ i ] , Ftype [ i ] , Fsize [ i ] , Fmount [ i ] ) ;
}
mvprintw ( 21 , 0 , " Commands available: " ) ;
mvprintw ( 22 , 0 , " (F)disk (D)isklabel (Q)uit " ) ;
mvprintw ( 23 , 0 , " Enter Command> " ) ;
i = getch ( ) ;
switch ( i ) {
case ' q ' : case ' Q ' :
return ;
case ' f ' : case ' F ' :
Fdisk ( ) ;
query_disks ( ) ;
break ;
case ' d ' : case ' D ' :
DiskLabel ( ) ;
break ;
default :
beep ( ) ;
}
}
1994-10-21 19:08:33 +01:00
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 11:10:43 +01:00
for ( i = 0 ; Dname [ i ] ; i + + )
close ( Dfd [ i ] ) ;
return ;
}
#if 0
1994-10-20 06:00:00 +01:00
while ( ! ready ) {
ready = 1 ;
inst_disk = select_disk ( ) ;
if ( read_mbr ( avail_fds [ inst_disk ] , mbr ) = = - 1 ) {
1994-10-26 05:09:19 +01:00
sprintf ( scratch , " The following error occured while trying \n to read the master boot record: \n \n %s \n In order to install FreeBSD a new master boot record \n will have to be written which will mean all current \n data on the hard disk will be lost. " , errmsg ) ;
1994-10-20 06:00:00 +01:00
ok = 0 ;
while ( ! ok ) {
AskAbort ( scratch ) ;
if ( ! dialog_yesno ( TITLE , " Are you sure you wish to proceed? " ,
10 , 75 ) ) {
1994-10-20 20:30:56 +01:00
dialog_clear ( ) ;
1994-10-21 19:08:33 +01:00
if ( clear_mbr ( mbr , boot1 ) = = - 1 ) {
sprintf ( scratch , " \n \n Couldn't create new master boot record. \n \n %s " , errmsg ) ;
Fatal ( scratch ) ; ;
}
1994-10-20 06:00:00 +01:00
ok = 1 ;
}
1994-10-21 19:08:33 +01:00
dialog_clear ( ) ;
1994-10-20 06:00:00 +01:00
}
}
1994-10-21 19:08:33 +01:00
1994-10-20 06:00:00 +01:00
if ( custom_install )
if ( ! dialog_yesno ( TITLE , " Do you wish to edit the DOS partition table? " ,
10 , 75 ) ) {
1994-10-20 20:30:56 +01:00
dialog_clear ( ) ;
1994-10-20 06:00:00 +01:00
edit_mbr ( mbr , & avail_disklabels [ inst_disk ] ) ;
}
1994-10-21 19:08:33 +01:00
dialog_clear ( ) ;
1994-10-20 06:00:00 +01:00
inst_part = select_partition ( inst_disk ) ;
ok = 0 ;
while ( ! ok ) {
1994-10-21 19:08:33 +01:00
if ( build_mbr ( mbr , boot1 , & avail_disklabels [ inst_disk ] ) ! = - 1 ) {
ready = 1 ;
1994-10-20 06:00:00 +01:00
ok = 1 ;
1994-10-21 19:08:33 +01:00
} else {
sprintf ( scratch , " The DOS partition table is inconsistent. \n \n %s \n Do you wish to edit it by hand? " , errmsg ) ;
1994-10-20 06:00:00 +01:00
if ( ! dialog_yesno ( TITLE , scratch , 10 , 75 ) ) {
1994-10-20 20:30:56 +01:00
dialog_clear ( ) ;
1994-10-21 19:08:33 +01:00
edit_mbr ( mbr , & avail_disklabels [ inst_disk ] ) ;
1994-10-20 06:00:00 +01:00
} else {
1994-10-21 19:08:33 +01:00
dialog_clear ( ) ;
AskAbort ( " Installation cannot proceed without \n a valid master boot record \n " ) ;
1994-10-20 06:00:00 +01:00
ok = 1 ;
ready = 0 ;
}
}
1994-10-21 19:08:33 +01:00
dialog_clear ( ) ;
1994-10-20 06:00:00 +01:00
}
1994-10-21 19:08:33 +01:00
if ( ready ) {
default_disklabel ( & avail_disklabels [ inst_disk ] ,
1994-10-20 06:00:00 +01:00
mbr - > dospart [ inst_part ] . dp_size ,
mbr - > dospart [ inst_part ] . dp_start ) ;
1994-10-26 08:34:38 +01:00
dialog_msgbox ( TITLE , " This is an experimental disklabel configuration \n menu. It doesn't perform any validation of the entries \n as yet so BE SURE YOU TYPE THINGS CORRECTLY. \n \n Hit escape to quit the editor. \n \n There may be some delay exiting because of a dialog bug " , 20 , 70 , 1 ) ;
1994-10-26 05:09:19 +01:00
dialog_clear ( ) ;
edit_disklabel ( & avail_disklabels [ inst_disk ] ) ;
1994-10-29 11:01:40 +01:00
1994-10-26 08:34:38 +01:00
build_disklabel ( & avail_disklabels [ inst_disk ] ) ;
1994-10-21 19:08:33 +01:00
if ( build_bootblocks ( & avail_disklabels [ inst_disk ] ) = = - 1 )
Fatal ( errmsg ) ;
}
1994-10-20 06:00:00 +01:00
1994-10-21 19:08:33 +01:00
/* ready could have been reset above */
1994-10-20 06:00:00 +01:00
if ( ready ) {
if ( dialog_yesno ( TITLE , " We are now ready to format the hard disk for FreeBSD. \n \n Some or all of the disk will be overwritten during this process. \n \n Are you sure you wish to proceed ? " , 10 , 75 ) ) {
1994-10-21 19:08:33 +01:00
dialog_clear ( ) ;
AskAbort ( " Do you want to quit? " ) ;
1994-10-20 06:00:00 +01:00
ready = 0 ;
}
1994-10-20 20:30:56 +01:00
dialog_clear ( ) ;
1994-10-20 06:00:00 +01:00
}
}
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 11:10:43 +01:00
if ( getenv ( " STAGE0 " ) ) {
Fatal ( " We stop here " ) ;
}
1994-10-20 06:00:00 +01:00
/* Write master boot record and bootblocks */
1994-10-21 19:08:33 +01:00
if ( write_mbr ( avail_fds [ inst_disk ] , mbr ) = = - 1 )
Fatal ( errmsg ) ;
if ( write_bootblocks ( avail_fds [ inst_disk ] ,
1994-10-29 13:03:59 +01:00
mbr - > dospart [ inst_part ] . dp_start ,
avail_disklabels [ inst_disk ] . d_bbsize ) = = - 1 )
1994-10-21 19:08:33 +01:00
Fatal ( errmsg ) ;
1994-10-20 06:00:00 +01:00
/* close all the open disks */
for ( i = 0 ; i < no_disks ; i + + )
if ( close ( avail_fds [ i ] ) = = - 1 ) {
sprintf ( errmsg , " Error on closing file descriptors: %s \n " ,
strerror ( errno ) ) ;
Fatal ( errmsg ) ;
}
}
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 11:10:43 +01:00
# endif