Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 312 → Rev 311

/install/install.c
386,7 → 386,7
long res;
union REGS r;
r.h.ah = 0x36; /* DOS 2+ get free disk space */
r.h.dl = drv; /* A=1, B=2, etc */
r.h.dl = drv;
int86(0x21, &r, &r);
if (r.x.ax == 0xffffu) return(-1); /* AX set to FFFFh if drive invalid */
res = r.x.ax; /* sectors per cluster */
454,11 → 454,7
int ds;
int choice;
char buff[1024];
int driveid = 1; /* fdisk runs on first drive (unless USB boot) */
if (selecteddrive == get_cur_drive() + 1) { /* get_cur_drive() returns 0-based values (A=0) while selecteddrive is 1-based (A=1) */
selecteddrive = 4; /* use D: if install is run from C: (typically because it was booted from USB?) */
driveid = 2; /* primary drive is the emulated USB storage */
}
if (selecteddrive == get_cur_drive()) selecteddrive = 4; /* use D: if install is run from C: (typically because it was booted from USB?) */
cselecteddrive = 'A' + selecteddrive - 1;
for (;;) {
driveremovable = isdriveremovable(selecteddrive);
472,14 → 468,12
putstringwrap(4, 1, COLOR_BODY[mono], buff);
switch (menuselect(14, -1, 5, list, -1)) {
case 0:
sprintf(buff, "FDISK /AUTO %d", driveid);
system(buff);
system("FDISK /AUTO"); /* TODO DRIVE SHOULD BE SPECIFIED FOR MULTI-DRIVE SYSTEMS ! */
break;
case 1:
video_clear(0x0700, 0, 0);
video_movecursor(0, 0);
sprintf(buff, "FDISK %d", driveid);
system(buff);
system("FDISK"); /* TODO DRIVE SHOULD BE SPECIFIED FOR MULTI-DRIVE SYSTEMS ! */
break;
case 2:
return(MENUQUIT);
488,8 → 482,7
}
/* write a temporary MBR which only skips the drive (in case BIOS would
* try to boot off the not-yet-ready C: disk) */
sprintf(buff, "FDISK /AMBR %d", driveid);
system(buff); /* writes BOOT.MBR into actual MBR */
system("FDISK /AMBR"); /* writes BOOT.MBR into actual MBR */ /* TODO DRIVE SHOULD BE SPECIFIED FOR MULTI-DRIVE SYSTEMS ! */
newscreen(2);
putstringnls(10, 10, COLOR_BODY[mono], 3, 1, "Your computer will reboot now.");
putstringnls(12, 10, COLOR_BODY[mono], 0, 5, "Press any key...");
528,7 → 521,7
if (ds < SVARDOS_DISK_REQ) {
int y = 9;
newscreen(2);
snprintf(buff, sizeof(buff), kittengets(3, 4, "ERROR: Drive %c: is not big enough! SvarDOS requires a disk of at least %d MiB."), cselecteddrive, SVARDOS_DISK_REQ);
snprintf(buff, sizeof(buff), kittengets(3, 4, "ERROR: Drive %c: is not big enough! SvarDOS requires a disk of at least %d MiB."), cselecteddrive);
y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
input_getkey();
562,13 → 555,9
if (choice < 0) return(MENUPREV);
if (choice == 1) return(MENUQUIT);
snprintf(buff, sizeof(buff), "SYS %c: %c: > NUL", sourcedrv, cselecteddrive);
puts(buff);
system(buff);
sprintf(buff, "FDISK /MBR %d", driveid);
puts(buff);
system(buff);
system("FDISK /MBR"); /* TODO DRIVE SHOULD BE SPECIFIED FOR MULTI-DRIVE SYSTEMS ! */
snprintf(buff, sizeof(buff), "%c:\\TEMP", cselecteddrive);
puts(buff);
mkdir(buff);
return(cselecteddrive);
}
616,7 → 605,7
fprintf(fd, "DOS=UMB,HIGH\r\n"
"LASTDRIVE=Z\r\n"
"FILES=50\r\n");
fprintf(fd, "DEVICE=C:\\SVARDOS\\BIN\\HIMEMX.EXE\r\n");
fprintf(fd, "DEVICE=%c:\\SVARDOS\\BIN\\HIMEMX.EXE\r\n", targetdrv);
if (strcmp(locales->lang, "EN") == 0) {
strcpy(buff, "COMMAND");
} else {
875,7 → 864,7
action = welcomescreen(); /* what svardos is, ask whether to run live dos or install */
if (action == MENUQUIT) goto Quit;
if (action == MENUPREV) goto SelectLang;
targetdrv = preparedrive(sourcedrv); /* what drive should we install from? check avail. space */
targetdrv = preparedrive(sourcedrv); /* what drive should we install to? check avail. space */
if (targetdrv == MENUQUIT) goto Quit;
if (targetdrv == MENUPREV) goto WelcomeScreen;
bootfilesgen(targetdrv, &locales); /* generate boot files and other configurations */