Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* SVAROG386 INSTALL
|
2 |
* SVARDOS INSTALL PROGRAM
|
3 |
* COPYRIGHT (C) 2016 MATEUSZ VISTE, ALL RIGHTS RESERVED.
|
3 |
* PUBLISHED UNDER THE TERMS OF THE MIT LICENSE
|
4 |
*
|
4 |
*
|
5 |
* Redistribution and use in source and binary forms, with or without
|
5 |
* COPYRIGHT (C) 2016-2021 MATEUSZ VISTE, ALL RIGHTS RESERVED.
|
6 |
* modification, are permitted provided that the following conditions are met:
|
- |
|
7 |
*
|
6 |
*
|
- |
|
7 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
- |
|
8 |
* copy of this software and associated documentation files (the "Software"),
|
8 |
* 1. Redistributions of source code must retain the above copyright notice,
|
9 |
* to deal in the Software without restriction, including without limitation
|
- |
|
10 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
- |
|
11 |
* and/or sell copies of the Software, and to permit persons to whom the
|
9 |
* this list of conditions and the following disclaimer.
|
12 |
* Software is furnished to do so, subject to the following conditions:
|
10 |
*
|
13 |
*
|
11 |
* 2. Redistributions in binary form must reproduce the above copyright
|
- |
|
12 |
* notice, this list of conditions and the following disclaimer in the
|
14 |
* The above copyright notice and this permission notice shall be included in
|
13 |
* documentation and/or other materials provided with the distribution.
|
15 |
* all copies or substantial portions of the Software.
|
14 |
*
|
16 |
*
|
15 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
17 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
- |
|
17 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
18 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
- |
|
19 |
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
19 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20 |
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
- |
|
21 |
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
- |
|
22 |
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
20 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23 |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
24 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
25 |
* POSSIBILITY OF SUCH DAMAGE.
|
23 |
* DEALINGS IN THE SOFTWARE.
|
26 |
*
|
24 |
*
|
27 |
* http://svarog386.sf.net
|
25 |
* http://svardos.osdn.io
|
28 |
*/
|
26 |
*/
|
29 |
|
27 |
|
30 |
#include <dos.h>
|
28 |
#include <dos.h>
|
31 |
#include <direct.h> /* mkdir() */
|
29 |
#include <direct.h> /* mkdir() */
|
32 |
#include <stdio.h> /* printf() and friends */
|
30 |
#include <stdio.h> /* printf() and friends */
|
Line 51... |
Line 49... |
51 |
static unsigned short COLOR_SELECTCUR[2] = {0x1F00,0x0700};
|
49 |
static unsigned short COLOR_SELECTCUR[2] = {0x1F00,0x0700};
|
52 |
|
50 |
|
53 |
/* mono flag */
|
51 |
/* mono flag */
|
54 |
static int mono = 0;
|
52 |
static int mono = 0;
|
55 |
|
53 |
|
56 |
/* how much disk space does Svarog386 require (in MiB) */
|
54 |
/* how much disk space does SvarDOS require (in MiB) */
|
57 |
#define SVAROG_DISK_REQ 8
|
55 |
#define SVARDOS_DISK_REQ 8
|
58 |
|
56 |
|
59 |
/* menu screens can output only one of these: */
|
57 |
/* menu screens can output only one of these: */
|
60 |
#define MENUNEXT 0
|
58 |
#define MENUNEXT 0
|
61 |
#define MENUPREV -1
|
59 |
#define MENUPREV -1
|
62 |
#define MENUQUIT -2
|
60 |
#define MENUQUIT -2
|
Line 187... |
Line 185... |
187 |
}
|
185 |
}
|
188 |
}
|
186 |
}
|
189 |
|
187 |
|
190 |
static void newscreen(int statusbartype) {
|
188 |
static void newscreen(int statusbartype) {
|
191 |
char *msg;
|
189 |
char *msg;
|
192 |
msg = kittengets(0, 0, "SVAROG386 INSTALLATION");
|
190 |
msg = kittengets(0, 0, "SVARDOS INSTALLATION");
|
193 |
video_putcharmulti(0, 0, COLOR_TITLEBAR[mono], ' ', 80, 1);
|
191 |
video_putcharmulti(0, 0, COLOR_TITLEBAR[mono], ' ', 80, 1);
|
194 |
video_putstring(0, 40 - (strlen(msg) >> 1), COLOR_TITLEBAR[mono], msg, -1);
|
192 |
video_putstring(0, 40 - (strlen(msg) >> 1), COLOR_TITLEBAR[mono], msg, -1);
|
195 |
video_clear(COLOR_BODY[mono], 80, -80);
|
193 |
video_clear(COLOR_BODY[mono], 80, -80);
|
196 |
switch (statusbartype) {
|
194 |
switch (statusbartype) {
|
197 |
case 1:
|
195 |
case 1:
|
Line 242... |
Line 240... |
242 |
"Turkish",
|
240 |
"Turkish",
|
243 |
NULL
|
241 |
NULL
|
244 |
};
|
242 |
};
|
245 |
|
243 |
|
246 |
newscreen(1);
|
244 |
newscreen(1);
|
247 |
msg = kittengets(1, 0, "Welcome to Svarog386");
|
245 |
msg = kittengets(1, 0, "Welcome to SvarDOS");
|
248 |
x = 40 - (strlen(msg) >> 1);
|
246 |
x = 40 - (strlen(msg) >> 1);
|
249 |
video_putstring(4, x, COLOR_BODY[mono], msg, -1);
|
247 |
video_putstring(4, x, COLOR_BODY[mono], msg, -1);
|
250 |
video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
|
248 |
video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
|
251 |
putstringnls(8, -1, COLOR_BODY[mono], 1, 1, "Please select your language from the list below:");
|
249 |
putstringnls(8, -1, COLOR_BODY[mono], 1, 1, "Please select your language from the list below:");
|
252 |
choice = menuselect(11, -1, 11, langlist, -1);
|
250 |
choice = menuselect(11, -1, 11, langlist, -1);
|
Line 309... |
Line 307... |
309 |
|
307 |
|
310 |
static int selectkeyb(struct slocales *locales) {
|
308 |
static int selectkeyb(struct slocales *locales) {
|
311 |
int menuheight, choice;
|
309 |
int menuheight, choice;
|
312 |
if (locales->keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
|
310 |
if (locales->keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
|
313 |
newscreen(0);
|
311 |
newscreen(0);
|
314 |
putstringnls(5, 1, COLOR_BODY[mono], 1, 5, "Svarog386 supports the keyboard layouts used in different countries. Choose the keyboard layout you want.");
|
312 |
putstringnls(5, 1, COLOR_BODY[mono], 1, 5, "SvarDOS supports the keyboard layouts used in different countries. Choose the keyboard layout you want.");
|
315 |
menuheight = locales->keyblen + 2;
|
313 |
menuheight = locales->keyblen + 2;
|
316 |
if (menuheight > 13) menuheight = 13;
|
314 |
if (menuheight > 13) menuheight = 13;
|
317 |
choice = menuselect(10, -1, menuheight, &(kblayouts[locales->keyboff]), locales->keyblen);
|
315 |
choice = menuselect(10, -1, menuheight, &(kblayouts[locales->keyboff]), locales->keyblen);
|
318 |
if (choice < 0) return(MENUPREV);
|
316 |
if (choice < 0) return(MENUPREV);
|
319 |
/* (re)load the keyboard layout & codepage setup */
|
317 |
/* (re)load the keyboard layout & codepage setup */
|
Line 324... |
Line 322... |
324 |
|
322 |
|
325 |
|
323 |
|
326 |
/* returns 0 if installation must proceed, non-zero otherwise */
|
324 |
/* returns 0 if installation must proceed, non-zero otherwise */
|
327 |
static int welcomescreen(void) {
|
325 |
static int welcomescreen(void) {
|
328 |
int c;
|
326 |
int c;
|
329 |
char *choice[] = {"Install Svarog386 to disk", "Quit to DOS", NULL};
|
327 |
char *choice[] = {"Install SvarDOS to disk", "Quit to DOS", NULL};
|
330 |
choice[0] = kittengets(0, 1, choice[0]);
|
328 |
choice[0] = kittengets(0, 1, choice[0]);
|
331 |
choice[1] = kittengets(0, 2, choice[1]);
|
329 |
choice[1] = kittengets(0, 2, choice[1]);
|
332 |
newscreen(0);
|
330 |
newscreen(0);
|
333 |
putstringnls(4, 1, COLOR_BODY[mono], 2, 0, "You are about to install Svarog386: a free, MSDOS-compatible operating system based on the FreeDOS kernel. Svarog386 targets 386+ computers and comes with a variety of third-party applications.\n\nWARNING: If your PC has another operating system installed, this other system might be unable to boot once Svarog386 is installed.");
|
331 |
putstringnls(4, 1, COLOR_BODY[mono], 2, 0, "You are about to install SvarDOS: a free, MSDOS-compatible operating system based on the FreeDOS kernel. SvarDOS targets 386+ computers and comes with a variety of third-party applications.\n\nWARNING: If your PC has another operating system installed, this other system might be unable to boot once SvarDOS is installed.");
|
334 |
c = menuselect(13, -1, 4, choice, -1);
|
332 |
c = menuselect(13, -1, 4, choice, -1);
|
335 |
if (c < 0) return(MENUPREV);
|
333 |
if (c < 0) return(MENUPREV);
|
336 |
if (c == 0) return(MENUNEXT);
|
334 |
if (c == 0) return(MENUNEXT);
|
337 |
return(MENUQUIT);
|
335 |
return(MENUQUIT);
|
338 |
}
|
336 |
}
|
Line 399... |
Line 397... |
399 |
char *list[] = { "Create a partition automatically", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
|
397 |
char *list[] = { "Create a partition automatically", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
|
400 |
newscreen(0);
|
398 |
newscreen(0);
|
401 |
list[0] = kittengets(0, 3, list[0]);
|
399 |
list[0] = kittengets(0, 3, list[0]);
|
402 |
list[1] = kittengets(0, 4, list[1]);
|
400 |
list[1] = kittengets(0, 4, list[1]);
|
403 |
list[2] = kittengets(0, 2, list[2]);
|
401 |
list[2] = kittengets(0, 2, list[2]);
|
404 |
snprintf(buff, sizeof(buff), kittengets(3, 0, "ERROR: Drive %c: could not be found. Perhaps your hard disk needs to be partitioned first. Please create at least one partition on your hard disk, so Svarog386 can be installed on it. Note, that Svarog386 requires at least %d MiB of available disk space.\n\nYou can use the FDISK partitioning tool for creating the required partition manually, or you can let the installer partitioning your disk automatically. You can also abort the installation to use any other partition manager of your choice."), cselecteddrive, SVAROG_DISK_REQ);
|
402 |
snprintf(buff, sizeof(buff), kittengets(3, 0, "ERROR: Drive %c: could not be found. Perhaps your hard disk needs to be partitioned first. Please create at least one partition on your hard disk, so SvarDOS can be installed on it. Note, that SvarDOS requires at least %d MiB of available disk space.\n\nYou can use the FDISK partitioning tool for creating the required partition manually, or you can let the installer partitioning your disk automatically. You can also abort the installation to use any other partition manager of your choice."), cselecteddrive, SVARDOS_DISK_REQ);
|
405 |
putstringwrap(4, 1, COLOR_BODY[mono], buff);
|
403 |
putstringwrap(4, 1, COLOR_BODY[mono], buff);
|
406 |
switch (menuselect(14, -1, 5, list, -1)) {
|
404 |
switch (menuselect(14, -1, 5, list, -1)) {
|
407 |
case 0:
|
405 |
case 0:
|
408 |
system("FDISK /AUTO");
|
406 |
system("FDISK /AUTO");
|
409 |
break;
|
407 |
break;
|
Line 447... |
Line 445... |
447 |
choice = menuselect(12, -1, 4, list, -1);
|
445 |
choice = menuselect(12, -1, 4, list, -1);
|
448 |
if (choice < 0) return(MENUPREV);
|
446 |
if (choice < 0) return(MENUPREV);
|
449 |
if (choice == 1) return(MENUQUIT);
|
447 |
if (choice == 1) return(MENUQUIT);
|
450 |
video_clear(0x0700, 0, 0);
|
448 |
video_clear(0x0700, 0, 0);
|
451 |
video_movecursor(0, 0);
|
449 |
video_movecursor(0, 0);
|
452 |
snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVAROG386", cselecteddrive);
|
450 |
snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
|
453 |
system(buff);
|
451 |
system(buff);
|
454 |
continue;
|
452 |
continue;
|
455 |
}
|
453 |
}
|
456 |
/* check total disk space */
|
454 |
/* check total disk space */
|
457 |
ds = disksize(selecteddrive);
|
455 |
ds = disksize(selecteddrive);
|
458 |
if (ds < SVAROG_DISK_REQ) {
|
456 |
if (ds < SVARDOS_DISK_REQ) {
|
459 |
int y = 9;
|
457 |
int y = 9;
|
460 |
newscreen(2);
|
458 |
newscreen(2);
|
461 |
snprintf(buff, sizeof(buff), kittengets(3, 4, "ERROR: Drive %c: is not big enough! Svarog386 requires a disk of at least %d MiB."), cselecteddrive);
|
459 |
snprintf(buff, sizeof(buff), kittengets(3, 4, "ERROR: Drive %c: is not big enough! SvarDOS requires a disk of at least %d MiB."), cselecteddrive);
|
462 |
y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
|
460 |
y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
|
463 |
putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
|
461 |
putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
|
464 |
input_getkey();
|
462 |
input_getkey();
|
465 |
return(MENUQUIT);
|
463 |
return(MENUQUIT);
|
466 |
}
|
464 |
}
|
Line 469... |
Line 467... |
469 |
if (diskempty(selecteddrive) != 0) {
|
467 |
if (diskempty(selecteddrive) != 0) {
|
470 |
char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
|
468 |
char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
|
471 |
int y = 6;
|
469 |
int y = 6;
|
472 |
list[0] = kittengets(0, 6, list[0]);
|
470 |
list[0] = kittengets(0, 6, list[0]);
|
473 |
list[1] = kittengets(0, 2, list[1]);
|
471 |
list[1] = kittengets(0, 2, list[1]);
|
474 |
snprintf(buff, sizeof(buff), kittengets(3, 5, "ERROR: Drive %c: is not empty. Svarog386 must be installed on an empty disk.\n\nYou can format the disk now, to make it empty. Note however, that this will ERASE ALL CURRENT DATA on your disk."), cselecteddrive);
|
472 |
snprintf(buff, sizeof(buff), kittengets(3, 5, "ERROR: Drive %c: is not empty. SvarDOS must be installed on an empty disk.\n\nYou can format the disk now, to make it empty. Note however, that this will ERASE ALL CURRENT DATA on your disk."), cselecteddrive);
|
475 |
y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
|
473 |
y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
|
476 |
choice = menuselect(++y, -1, 4, list, -1);
|
474 |
choice = menuselect(++y, -1, 4, list, -1);
|
477 |
if (choice < 0) return(MENUPREV);
|
475 |
if (choice < 0) return(MENUPREV);
|
478 |
if (choice == 1) return(MENUQUIT);
|
476 |
if (choice == 1) return(MENUQUIT);
|
479 |
video_clear(0x0700, 0, 0);
|
477 |
video_clear(0x0700, 0, 0);
|
480 |
video_movecursor(0, 0);
|
478 |
video_movecursor(0, 0);
|
481 |
snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVAROG386", cselecteddrive);
|
479 |
snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
|
482 |
system(buff);
|
480 |
system(buff);
|
483 |
continue;
|
481 |
continue;
|
484 |
} else {
|
482 |
} else {
|
485 |
/* final confirmation */
|
483 |
/* final confirmation */
|
486 |
char *list[] = { "Install Svarog386", "Quit to DOS", NULL};
|
484 |
char *list[] = { "Install SvarDOS", "Quit to DOS", NULL};
|
487 |
list[0] = kittengets(0, 1, list[0]);
|
485 |
list[0] = kittengets(0, 1, list[0]);
|
488 |
list[1] = kittengets(0, 2, list[1]);
|
486 |
list[1] = kittengets(0, 2, list[1]);
|
489 |
snprintf(buff, sizeof(buff), kittengets(3, 6, "The installation of Svarog386 to %c: is about to begin."), cselecteddrive);
|
487 |
snprintf(buff, sizeof(buff), kittengets(3, 6, "The installation of SvarDOS to %c: is about to begin."), cselecteddrive);
|
490 |
video_putstring(7, -1, COLOR_BODY[mono], buff, -1);
|
488 |
video_putstring(7, -1, COLOR_BODY[mono], buff, -1);
|
491 |
choice = menuselect(10, -1, 4, list, -1);
|
489 |
choice = menuselect(10, -1, 4, list, -1);
|
492 |
if (choice < 0) return(MENUPREV);
|
490 |
if (choice < 0) return(MENUPREV);
|
493 |
if (choice == 1) return(MENUQUIT);
|
491 |
if (choice == 1) return(MENUQUIT);
|
494 |
snprintf(buff, sizeof(buff), "SYS A: %c: > NUL", cselecteddrive);
|
492 |
snprintf(buff, sizeof(buff), "SYS A: %c: > NUL", cselecteddrive);
|
Line 536... |
Line 534... |
536 |
fd = fopen(buff, "wb");
|
534 |
fd = fopen(buff, "wb");
|
537 |
if (fd == NULL) return;
|
535 |
if (fd == NULL) return;
|
538 |
fprintf(fd, "DOS=UMB,HIGH\r\n"
|
536 |
fprintf(fd, "DOS=UMB,HIGH\r\n"
|
539 |
"LASTDRIVE=Z\r\n"
|
537 |
"LASTDRIVE=Z\r\n"
|
540 |
"FILES=50\r\n");
|
538 |
"FILES=50\r\n");
|
541 |
fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\HIMEMX.EXE\r\n", targetdrv);
|
539 |
fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVARDOS\\BIN\\HIMEMX.EXE\r\n", targetdrv);
|
542 |
if (strcmp(locales->lang, "EN") == 0) {
|
540 |
if (strcmp(locales->lang, "EN") == 0) {
|
543 |
strcpy(buff, "COMMAND");
|
541 |
strcpy(buff, "COMMAND");
|
544 |
} else {
|
542 |
} else {
|
545 |
snprintf(buff, sizeof(buff), "CMD-%s", locales->lang);
|
543 |
snprintf(buff, sizeof(buff), "CMD-%s", locales->lang);
|
546 |
}
|
544 |
}
|
547 |
fprintf(fd, "SHELLHIGH=%c:\\SYSTEM\\SVAROG.386\\BIN\\%s.COM /E:512 /P\r\n", targetdrv, buff);
|
545 |
fprintf(fd, "SHELLHIGH=%c:\\SYSTEM\\SVARDOS\\BIN\\%s.COM /E:512 /P\r\n", targetdrv, buff);
|
548 |
fprintf(fd, "REM COUNTRY=001,437,%c:\\SYSTEM\\CONF\\COUNTRY.SYS\r\n", targetdrv);
|
546 |
fprintf(fd, "REM COUNTRY=001,437,%c:\\SYSTEM\\CONF\\COUNTRY.SYS\r\n", targetdrv);
|
549 |
fprintf(fd, "DEVICE=%c:\\SYSTEM\\DRIVERS\\UDVD2\\UDVD2.SYS /D:SVCD0001 /H\r\n", targetdrv);
|
547 |
fprintf(fd, "DEVICE=%c:\\SYSTEM\\DRIVERS\\UDVD2\\UDVD2.SYS /D:SVCD0001 /H\r\n", targetdrv);
|
550 |
fclose(fd);
|
548 |
fclose(fd);
|
551 |
/*** AUTOEXEC.BAT ***/
|
549 |
/*** AUTOEXEC.BAT ***/
|
552 |
snprintf(buff, sizeof(buff), "%c:\\AUTOEXEC.BAT", targetdrv);
|
550 |
snprintf(buff, sizeof(buff), "%c:\\AUTOEXEC.BAT", targetdrv);
|
553 |
fd = fopen(buff, "wb");
|
551 |
fd = fopen(buff, "wb");
|
554 |
if (fd == NULL) return;
|
552 |
if (fd == NULL) return;
|
555 |
fprintf(fd, "@ECHO OFF\r\n");
|
553 |
fprintf(fd, "@ECHO OFF\r\n");
|
556 |
fprintf(fd, "SET TEMP=%c:\\TEMP\r\n", targetdrv);
|
554 |
fprintf(fd, "SET TEMP=%c:\\TEMP\r\n", targetdrv);
|
557 |
fprintf(fd, "SET DOSDIR=%c:\\SYSTEM\\SVAROG.386\r\n", targetdrv);
|
555 |
fprintf(fd, "SET DOSDIR=%c:\\SYSTEM\\SVARDOS\r\n", targetdrv);
|
558 |
fprintf(fd, "SET NLSPATH=%%DOSDIR%%\\NLS\r\n");
|
556 |
fprintf(fd, "SET NLSPATH=%%DOSDIR%%\\NLS\r\n");
|
559 |
fprintf(fd, "SET LANG=%s\r\n", locales->lang);
|
557 |
fprintf(fd, "SET LANG=%s\r\n", locales->lang);
|
560 |
fprintf(fd, "SET DIRCMD=/OGNE/P/4\r\n");
|
558 |
fprintf(fd, "SET DIRCMD=/OGNE/P/4\r\n");
|
561 |
fprintf(fd, "SET FDNPKG.CFG=%c:\\SYSTEM\\CFG\\FDNPKG.CFG\r\n", targetdrv);
|
559 |
fprintf(fd, "SET FDNPKG.CFG=%c:\\SYSTEM\\CFG\\FDNPKG.CFG\r\n", targetdrv);
|
562 |
fprintf(fd, "SET WATTCP.CFG=%c:\\SYSTEM\\CFG\\WATTCP.CFG\r\n", targetdrv);
|
560 |
fprintf(fd, "SET WATTCP.CFG=%c:\\SYSTEM\\CFG\\WATTCP.CFG\r\n", targetdrv);
|
Line 567... |
Line 565... |
567 |
fprintf(fd, "FDAPM APMDOS\r\n");
|
565 |
fprintf(fd, "FDAPM APMDOS\r\n");
|
568 |
fprintf(fd, "\r\n");
|
566 |
fprintf(fd, "\r\n");
|
569 |
if (locales->egafile > 0) {
|
567 |
if (locales->egafile > 0) {
|
570 |
fprintf(fd, "DISPLAY CON=(EGA,,1)\r\n");
|
568 |
fprintf(fd, "DISPLAY CON=(EGA,,1)\r\n");
|
571 |
if (locales->egafile == 1) {
|
569 |
if (locales->egafile == 1) {
|
572 |
fprintf(fd, "MODE CON CP PREPARE=((%u) %c:\\SYSTEM\\SVAROG.386\\CPI\\EGA.CPX)\r\n", locales->codepage, targetdrv);
|
570 |
fprintf(fd, "MODE CON CP PREPARE=((%u) %c:\\SYSTEM\\SVARDOS\\CPI\\EGA.CPX)\r\n", locales->codepage, targetdrv);
|
573 |
} else {
|
571 |
} else {
|
574 |
fprintf(fd, "MODE CON CP PREPARE=((%u) %c:\\SYSTEM\\SVAROG.386\\CPI\\EGA%d.CPX)\r\n", locales->codepage, targetdrv, locales->egafile);
|
572 |
fprintf(fd, "MODE CON CP PREPARE=((%u) %c:\\SYSTEM\\SVARDOS\\CPI\\EGA%d.CPX)\r\n", locales->codepage, targetdrv, locales->egafile);
|
575 |
}
|
573 |
}
|
576 |
fprintf(fd, "MODE CON CP SELECT=%u\r\n", locales->codepage);
|
574 |
fprintf(fd, "MODE CON CP SELECT=%u\r\n", locales->codepage);
|
577 |
}
|
575 |
}
|
578 |
if (locales->keybfile > 0) {
|
576 |
if (locales->keybfile > 0) {
|
579 |
if (locales->keybfile == 1) {
|
577 |
if (locales->keybfile == 1) {
|
Line 584... |
Line 582... |
584 |
if (locales->keybid == 0) {
|
582 |
if (locales->keybid == 0) {
|
585 |
buff3[0] = 0;
|
583 |
buff3[0] = 0;
|
586 |
} else {
|
584 |
} else {
|
587 |
snprintf(buff3, sizeof(buff3), " /ID:%d", locales->keybid);
|
585 |
snprintf(buff3, sizeof(buff3), " /ID:%d", locales->keybid);
|
588 |
}
|
586 |
}
|
589 |
fprintf(fd, "KEYB %s,%d,%c:\\SYSTEM\\SVAROG.386\\BIN\\%s%s\r\n", locales->keybcode, locales->codepage, targetdrv, buff2, buff3);
|
587 |
fprintf(fd, "KEYB %s,%d,%c:\\SYSTEM\\SVARDOS\\BIN\\%s%s\r\n", locales->keybcode, locales->codepage, targetdrv, buff2, buff3);
|
590 |
fprintf(fd, "\r\n");
|
588 |
fprintf(fd, "\r\n");
|
591 |
}
|
589 |
}
|
592 |
fprintf(fd, "SHSUCDX /d:SVCD0001\r\n");
|
590 |
fprintf(fd, "SHSUCDX /d:SVCD0001\r\n");
|
593 |
fprintf(fd, "\r\n");
|
591 |
fprintf(fd, "\r\n");
|
594 |
fprintf(fd, "REM Uncomment the line below for automatic mouse support\r\n");
|
592 |
fprintf(fd, "REM Uncomment the line below for automatic mouse support\r\n");
|
595 |
fprintf(fd, "REM CTMOUSE\r\n");
|
593 |
fprintf(fd, "REM CTMOUSE\r\n");
|
596 |
fprintf(fd, "\r\n");
|
594 |
fprintf(fd, "\r\n");
|
597 |
fprintf(fd, "ECHO.\r\n");
|
595 |
fprintf(fd, "ECHO.\r\n");
|
598 |
fprintf(fd, "ECHO %s\r\n", kittengets(6, 0, "Welcome to Svarog386! Type 'HELP' if you need help."));
|
596 |
fprintf(fd, "ECHO %s\r\n", kittengets(6, 0, "Welcome to SvarDOS! Type 'HELP' if you need help."));
|
599 |
fclose(fd);
|
597 |
fclose(fd);
|
600 |
/*** CREATE DIRECTORY FOR OTHER CONFIGURATION FILES ***/
|
598 |
/*** CREATE DIRECTORY FOR OTHER CONFIGURATION FILES ***/
|
601 |
snprintf(buff, sizeof(buff), "%c:\\SYSTEM\\CFG", targetdrv);
|
599 |
snprintf(buff, sizeof(buff), "%c:\\SYSTEM\\CFG", targetdrv);
|
602 |
mkdir(buff);
|
600 |
mkdir(buff);
|
603 |
/*** FDNPKG.CFG ***/
|
601 |
/*** FDNPKG.CFG ***/
|
Line 669... |
Line 667... |
669 |
char buff[64];
|
667 |
char buff[64];
|
670 |
newscreen(3);
|
668 |
newscreen(3);
|
671 |
/* count how long the pkg list is */
|
669 |
/* count how long the pkg list is */
|
672 |
for (pkglistlen = 0; pkglist[pkglistlen] != NULL; pkglistlen++);
|
670 |
for (pkglistlen = 0; pkglist[pkglistlen] != NULL; pkglistlen++);
|
673 |
/* set DOSDIR and friends */
|
671 |
/* set DOSDIR and friends */
|
674 |
snprintf(buff, sizeof(buff), "%c:\\SYSTEM\\SVAROG.386", targetdrv);
|
672 |
snprintf(buff, sizeof(buff), "%c:\\SYSTEM\\SVARDOS", targetdrv);
|
675 |
setenv("DOSDIR", buff, 1);
|
673 |
setenv("DOSDIR", buff, 1);
|
676 |
snprintf(buff, sizeof(buff), "%c:\\TEMP", targetdrv);
|
674 |
snprintf(buff, sizeof(buff), "%c:\\TEMP", targetdrv);
|
677 |
setenv("TEMP", buff, 1);
|
675 |
setenv("TEMP", buff, 1);
|
678 |
/* install packages */
|
676 |
/* install packages */
|
679 |
for (i = 0; pkglist[i] != NULL; i++) {
|
677 |
for (i = 0; pkglist[i] != NULL; i++) {
|
Line 692... |
Line 690... |
692 |
|
690 |
|
693 |
|
691 |
|
694 |
static void finalreboot(void) {
|
692 |
static void finalreboot(void) {
|
695 |
int y = 9;
|
693 |
int y = 9;
|
696 |
newscreen(2);
|
694 |
newscreen(2);
|
697 |
y += putstringnls(y, 1, COLOR_BODY[mono], 5, 0, "Svarog386 installation is over. Your computer will reboot now.\nPlease remove the installation disk from your drive.");
|
695 |
y += putstringnls(y, 1, COLOR_BODY[mono], 5, 0, "SvarDOS installation is over. Your computer will reboot now.\nPlease remove the installation disk from your drive.");
|
698 |
putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
|
696 |
putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
|
699 |
input_getkey();
|
697 |
input_getkey();
|
700 |
reboot();
|
698 |
reboot();
|
701 |
}
|
699 |
}
|
702 |
|
700 |
|
Line 724... |
Line 722... |
724 |
r.h.ah = 0; /* re-set video mode (to whatever is set in AL) */
|
722 |
r.h.ah = 0; /* re-set video mode (to whatever is set in AL) */
|
725 |
int86(0x10, &r, &r);
|
723 |
int86(0x10, &r, &r);
|
726 |
}
|
724 |
}
|
727 |
}
|
725 |
}
|
728 |
|
726 |
|
729 |
/* checks CD drive drv for the presence of the Svarog386 install CD
|
727 |
/* checks CD drive drv for the presence of the SvarDOS install CD
|
730 |
* returns 0 if found, non-zero otherwise */
|
728 |
* returns 0 if found, non-zero otherwise */
|
731 |
static int checkcd(char drv) {
|
729 |
static int checkcd(char drv) {
|
732 |
FILE *fd;
|
730 |
FILE *fd;
|
733 |
char fname[32];
|
731 |
char fname[32];
|
734 |
snprintf(fname, sizeof(fname), "%c:\\CORE\\MEM.ZIP", drv);
|
732 |
snprintf(fname, sizeof(fname), "%c:\\CORE\\MEM.ZIP", drv);
|
Line 751... |
Line 749... |
751 |
printf("ERROR: CD-ROM DRIVE NOT FOUND\r\n");
|
749 |
printf("ERROR: CD-ROM DRIVE NOT FOUND\r\n");
|
752 |
return(1);
|
750 |
return(1);
|
753 |
}
|
751 |
}
|
754 |
cdromdrv += 'A'; /* convert the cdrom 'id' (A=0) to an actual drive letter */
|
752 |
cdromdrv += 'A'; /* convert the cdrom 'id' (A=0) to an actual drive letter */
|
755 |
if (checkcd(cdromdrv) != 0) {
|
753 |
if (checkcd(cdromdrv) != 0) {
|
756 |
printf("ERROR: SVAROG386 INSTALLATION CD NOT FOUND IN THE DRIVE.\r\n");
|
754 |
printf("ERROR: SVARDOS INSTALLATION CD NOT FOUND IN THE DRIVE.\r\n");
|
757 |
return(1);
|
755 |
return(1);
|
758 |
}
|
756 |
}
|
759 |
|
757 |
|
760 |
/* init screen and detect mono status */
|
758 |
/* init screen and detect mono status */
|
761 |
mono = video_init();
|
759 |
mono = video_init();
|
762 |
|
760 |
|
763 |
kittenopen("INSTALL"); /* load initial NLS support */
|
761 |
kittenopen("INSTALL"); /* load initial NLS support */
|
764 |
|
762 |
|
765 |
SelectLang:
|
763 |
SelectLang:
|
766 |
action = selectlang(&locales); /* welcome to svarog, select your language */
|
764 |
action = selectlang(&locales); /* welcome to svardos, select your language */
|
767 |
if (action != MENUNEXT) goto Quit;
|
765 |
if (action != MENUNEXT) goto Quit;
|
768 |
setenv("LANG", locales.lang, 1);
|
766 |
setenv("LANG", locales.lang, 1);
|
769 |
loadcp(&locales);
|
767 |
loadcp(&locales);
|
770 |
kittenclose(); /* reload NLS with new language */
|
768 |
kittenclose(); /* reload NLS with new language */
|
771 |
kittenopen("INSTALL"); /* NLS support */
|
769 |
kittenopen("INSTALL"); /* NLS support */
|
772 |
action = selectkeyb(&locales); /* what keyb layout should we use? */
|
770 |
action = selectkeyb(&locales); /* what keyb layout should we use? */
|
773 |
if (action == MENUQUIT) goto Quit;
|
771 |
if (action == MENUQUIT) goto Quit;
|
774 |
if (action == MENUPREV) goto SelectLang;
|
772 |
if (action == MENUPREV) goto SelectLang;
|
775 |
|
773 |
|
776 |
WelcomeScreen:
|
774 |
WelcomeScreen:
|
777 |
action = welcomescreen(); /* what svarog386 is, ask whether to run live dos or install */
|
775 |
action = welcomescreen(); /* what svardos is, ask whether to run live dos or install */
|
778 |
if (action == MENUQUIT) goto Quit;
|
776 |
if (action == MENUQUIT) goto Quit;
|
779 |
if (action == MENUPREV) goto SelectLang;
|
777 |
if (action == MENUPREV) goto SelectLang;
|
780 |
targetdrv = preparedrive(); /* what drive should we install to? check avail. space */
|
778 |
targetdrv = preparedrive(); /* what drive should we install to? check avail. space */
|
781 |
if (targetdrv == MENUQUIT) goto Quit;
|
779 |
if (targetdrv == MENUQUIT) goto Quit;
|
782 |
if (targetdrv == MENUPREV) goto WelcomeScreen;
|
780 |
if (targetdrv == MENUPREV) goto WelcomeScreen;
|