Line 99... |
Line 99... |
99 |
static void newscreen(void) {
|
99 |
static void newscreen(void) {
|
100 |
int x;
|
100 |
int x;
|
101 |
for (x = 0; x < 80; x++) video_putchar(0, x, COLOR_TITLEBAR[mono], ' ');
|
101 |
for (x = 0; x < 80; x++) video_putchar(0, x, COLOR_TITLEBAR[mono], ' ');
|
102 |
video_clear(COLOR_BODY[mono], 80);
|
102 |
video_clear(COLOR_BODY[mono], 80);
|
103 |
video_putstring(0, 29, COLOR_TITLEBAR[mono], "SVAROG386 INSTALLATION");
|
103 |
video_putstring(0, 29, COLOR_TITLEBAR[mono], "SVAROG386 INSTALLATION");
|
- |
|
104 |
video_movecursor(25,0);
|
104 |
}
|
105 |
}
|
105 |
|
106 |
|
106 |
|
107 |
|
107 |
static int selectlang(char *lang) {
|
108 |
static int selectlang(char *lang) {
|
108 |
int choice;
|
109 |
int choice;
|
Line 119... |
Line 120... |
119 |
"Turkish\0TR",
|
120 |
"Turkish\0TR",
|
120 |
NULL
|
121 |
NULL
|
121 |
};
|
122 |
};
|
122 |
|
123 |
|
123 |
newscreen();
|
124 |
newscreen();
|
124 |
video_putstring(3, 30, COLOR_BODY[mono], "Welcome to Svarog386");
|
125 |
video_putstring(4, 30, COLOR_BODY[mono], "Welcome to Svarog386");
|
125 |
video_putstring(4, 30, COLOR_BODY[mono], "====================");
|
126 |
video_putstring(5, 30, COLOR_BODY[mono], "====================");
|
126 |
video_putstring(6, 2, COLOR_BODY[mono], "Svarog386 is an operating system based on the FreeDOS kernel. It targets");
|
- |
|
127 |
video_putstring(7, 2, COLOR_BODY[mono], "386+ computers and comes with a variety of third-party applications. Before");
|
- |
|
128 |
video_putstring(8, 2, COLOR_BODY[mono], "we get to serious business, please select your preferred language from the");
|
- |
|
129 |
video_putstring(9, 2, COLOR_BODY[mono], "list below, and press the ENTER key:");
|
127 |
video_putstring(8, 2, COLOR_BODY[mono], "Please select your language from the list below:");
|
130 |
choice = menuselect(11, -1, 12, langlist);
|
128 |
choice = menuselect(10, -1, 12, langlist);
|
131 |
if (choice < 0) return(-1);
|
129 |
if (choice < 0) return(-1);
|
132 |
/* write short language code into lang */
|
130 |
/* write short language code into lang */
|
133 |
for (code = langlist[choice]; *code != 0; code++);
|
131 |
for (code = langlist[choice]; *code != 0; code++);
|
134 |
memcpy(lang, code + 1, 2);
|
132 |
memcpy(lang, code + 1, 2);
|
135 |
lang[2] = 0;
|
133 |
lang[2] = 0;
|
Line 139... |
Line 137... |
139 |
|
137 |
|
140 |
/* returns 0 if installation must proceed, non-zero otherwise */
|
138 |
/* returns 0 if installation must proceed, non-zero otherwise */
|
141 |
static int welcomescreen(void) {
|
139 |
static int welcomescreen(void) {
|
142 |
char *choice[] = {"Install Svarog386 to disk", "Quit to DOS", NULL};
|
140 |
char *choice[] = {"Install Svarog386 to disk", "Quit to DOS", NULL};
|
143 |
newscreen();
|
141 |
newscreen();
|
144 |
video_putstring(4, 1, COLOR_BODY[mono], "You are about to install Svarog386, a free, MSDOS-compatible operating system");
|
142 |
video_putstring(4, 1, COLOR_BODY[mono], "You are about to install Svarog386: a free, MSDOS-compatible operating system");
|
- |
|
143 |
video_putstring(5, 1, COLOR_BODY[mono], "based on the FreeDOS kernel. Svarog386 targets 386+ computers and comes with a");
|
145 |
video_putstring(5, 1, COLOR_BODY[mono], "based on the FreeDOS kernel.");
|
144 |
video_putstring(6, 1, COLOR_BODY[mono], "variety of third-party applications.");
|
146 |
video_putstring(7, 1, COLOR_BODY[mono], "WARNING: If your PC has another operating system installed, this other system");
|
145 |
video_putstring(8, 1, COLOR_BODY[mono], "WARNING: If your PC has another operating system installed, this other system");
|
147 |
video_putstring(8, 1, COLOR_BODY[mono], " might be unable to boot once Svarog386 is installed.");
|
146 |
video_putstring(9, 1, COLOR_BODY[mono], " might be unable to boot once Svarog386 is installed.");
|
148 |
return(menuselect(14, -1, 4, choice));
|
147 |
return(menuselect(14, -1, 4, choice));
|
149 |
}
|
148 |
}
|
150 |
|
149 |
|
151 |
|
150 |
|
152 |
/* returns 1 if drive is removable, 0 if not, -1 on error */
|
151 |
/* returns 1 if drive is removable, 0 if not, -1 on error */
|
Line 195... |
Line 194... |
195 |
}
|
194 |
}
|
196 |
|
195 |
|
197 |
|
196 |
|
198 |
static int preparedrive(void) {
|
197 |
static int preparedrive(void) {
|
199 |
int driveremovable;
|
198 |
int driveremovable;
|
200 |
int selecteddrive = 3; /* hardcoded to 'C:' */
|
199 |
int selecteddrive = 3; /* hardcoded to 'C:' for now */
|
- |
|
200 |
int cselecteddrive;
|
201 |
int ds;
|
201 |
int ds;
|
- |
|
202 |
char buff[128];
|
- |
|
203 |
cselecteddrive = 'A' + selecteddrive - 1;
|
202 |
for (;;) {
|
204 |
for (;;) {
|
203 |
newscreen();
|
205 |
newscreen();
|
204 |
driveremovable = isdriveremovable(selecteddrive);
|
206 |
driveremovable = isdriveremovable(selecteddrive);
|
205 |
if (driveremovable < 0) {
|
207 |
if (driveremovable < 0) {
|
206 |
char *list[] = { "Create an automatic partition", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
|
208 |
char *list[] = { "Create an automatic partition", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
|
Line 228... |
Line 230... |
228 |
video_putstring(11, 10, COLOR_BODY[mono], "Your computer will reboot now. Press any key.");
|
230 |
video_putstring(11, 10, COLOR_BODY[mono], "Your computer will reboot now. Press any key.");
|
229 |
input_getkey();
|
231 |
input_getkey();
|
230 |
reboot();
|
232 |
reboot();
|
231 |
return(-1);
|
233 |
return(-1);
|
232 |
} else if (driveremovable > 0) {
|
234 |
} else if (driveremovable > 0) {
|
233 |
video_putstring(9, 2, COLOR_BODY[mono], "ERROR: Drive C: appears to be a removable device.");
|
235 |
sprintf(buff, "ERROR: Drive %c: appears to be a removable device.");
|
- |
|
236 |
video_putstring(9, 2, COLOR_BODY[mono], buff);
|
234 |
video_putstring(11, 2, COLOR_BODY[mono], "Installation aborted. Press any key.");
|
237 |
video_putstring(11, 2, COLOR_BODY[mono], "Installation aborted. Press any key.");
|
235 |
return(-1);
|
238 |
return(-1);
|
236 |
}
|
239 |
}
|
237 |
/* if not formatted, propose to format it right away (try to create a directory) */
|
240 |
/* if not formatted, propose to format it right away (try to create a directory) */
|
- |
|
241 |
sprintf(buff, "%c:\\SVWRTEST.123", cselecteddrive);
|
238 |
if (mkdir("C:\\SVWRTEST.123") != 0) {
|
242 |
if (mkdir(buff) != 0) {
|
239 |
char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
|
243 |
char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
|
- |
|
244 |
sprintf(buff, "ERROR: Drive %c: seems to be unformated.", cselecteddrive);
|
240 |
video_putstring(7, 2, COLOR_BODY[mono], "ERROR: Drive C: seems to be unformated.");
|
245 |
video_putstring(7, 2, COLOR_BODY[mono], buff);
|
241 |
video_putstring(8, 2, COLOR_BODY[mono], " Do you wish to format it?");
|
246 |
video_putstring(8, 2, COLOR_BODY[mono], " Do you wish to format it?");
|
242 |
if (menuselect(12, -1, 4, list) != 0) return(-1);
|
247 |
if (menuselect(12, -1, 4, list) != 0) return(-1);
|
243 |
video_clear(0x0700, 0);
|
248 |
video_clear(0x0700, 0);
|
244 |
video_movecursor(0, 0);
|
249 |
video_movecursor(0, 0);
|
245 |
system("FORMAT C: /Q /U /V:SVAROG");
|
250 |
sprintf(buff, "FORMAT %c: /Q /U /V:SVAROG386", cselecteddrive);
|
- |
|
251 |
system(buff);
|
246 |
continue;
|
252 |
continue;
|
247 |
}
|
253 |
}
|
- |
|
254 |
sprintf(buff, "%c:\\SVWRTEST.123", cselecteddrive);
|
248 |
rmdir("C:\\SVWRTEST.123");
|
255 |
rmdir("C:\\SVWRTEST.123");
|
249 |
/* check total disk space */
|
256 |
/* check total disk space */
|
250 |
ds = disksize(selecteddrive);
|
257 |
ds = disksize(selecteddrive);
|
251 |
if (ds < 16) {
|
258 |
if (ds < 16) {
|
252 |
video_putstring(9, 2, COLOR_BODY[mono], "ERROR: Drive C: is not big enough!");
|
259 |
video_putstring(9, 2, COLOR_BODY[mono], "ERROR: Drive C: is not big enough!");
|
Line 262... |
Line 269... |
262 |
video_putstring(8, 2, COLOR_BODY[mono], " You can format the disk now, to make it empty. Note however, that");
|
269 |
video_putstring(8, 2, COLOR_BODY[mono], " You can format the disk now, to make it empty. Note however, that");
|
263 |
video_putstring(9, 2, COLOR_BODY[mono], " this will ERASE ALL CURRENT DATA on your disk.");
|
270 |
video_putstring(9, 2, COLOR_BODY[mono], " this will ERASE ALL CURRENT DATA on your disk.");
|
264 |
if (menuselect(12, -1, 4, list) != 0) return(-1);
|
271 |
if (menuselect(12, -1, 4, list) != 0) return(-1);
|
265 |
video_clear(0x0700, 0);
|
272 |
video_clear(0x0700, 0);
|
266 |
video_movecursor(0, 0);
|
273 |
video_movecursor(0, 0);
|
267 |
system("FORMAT C: /Q /U /V:SVAROG");
|
274 |
system("FORMAT C: /Q /U /V:SVAROG386");
|
268 |
continue;
|
275 |
continue;
|
269 |
} else {
|
276 |
} else {
|
270 |
/* final confirmation */
|
277 |
/* final confirmation */
|
271 |
char *list[] = { "Install Svarog386", "Quit to DOS", NULL};
|
278 |
char *list[] = { "Install Svarog386", "Quit to DOS", NULL};
|
272 |
video_putstring(7, 2, COLOR_BODY[mono], "The installation of Svarog386 to your C: disk is about to begin.");
|
279 |
sprintf(buff, "The installation of Svarog386 to your %c: disk is about to begin.", cselecteddrive);
|
- |
|
280 |
video_putstring(7, 2, COLOR_BODY[mono], buff);
|
273 |
if (menuselect(10, -1, 4, list) != 0) return(-1);
|
281 |
if (menuselect(10, -1, 4, list) != 0) return(-1);
|
- |
|
282 |
sprintf(buff, "SYS A: %c:", cselecteddrive);
|
274 |
system("SYS A: C:");
|
283 |
system(buff);
|
- |
|
284 |
sprintf(buff, "%c:\\TEMP", cselecteddrive);
|
275 |
mkdir("C:\\TEMP");
|
285 |
mkdir(buff);
|
276 |
return(0);
|
286 |
return(cselecteddrive);
|
277 |
}
|
287 |
}
|
278 |
}
|
288 |
}
|
279 |
}
|
289 |
}
|
280 |
|
290 |
|
281 |
|
291 |
|
282 |
static void finalreboot(void) {
|
292 |
static void finalreboot(void) {
|
283 |
newscreen();
|
293 |
newscreen();
|
284 |
video_putstring(10, 2, COLOR_BODY[mono], "Svarog386 installation is over. Please remove the");
|
294 |
video_putstring(10, 2, COLOR_BODY[mono], "Svarog386 installation is over. Please remove the installation");
|
285 |
video_putstring(10, 2, COLOR_BODY[mono], "installation diskette and/or CD from the drive.");
|
295 |
video_putstring(11, 2, COLOR_BODY[mono], "diskette and/or CD from the drive.");
|
286 |
video_putstring(13, 2, COLOR_BODY[mono], "Press any key to reboot...");
|
296 |
video_putstring(13, 2, COLOR_BODY[mono], "Press any key to reboot...");
|
287 |
input_getkey();
|
297 |
input_getkey();
|
288 |
reboot();
|
298 |
reboot();
|
289 |
}
|
299 |
}
|
290 |
|
300 |
|
291 |
|
301 |
|
292 |
static void bootfilesgen(int targetdrv, char *lang) {
|
302 |
static void bootfilesgen(int targetdrv, char *lang) {
|
293 |
char drv = 'A' + targetdrv - 1;
|
- |
|
294 |
char buff[128];
|
303 |
char buff[128];
|
295 |
FILE *fd;
|
304 |
FILE *fd;
|
296 |
/*** AUTOEXEC.BAT ***/
|
305 |
/*** AUTOEXEC.BAT ***/
|
297 |
sprintf(buff, "%c:\\AUTOEXEC.BAT", drv);
|
306 |
sprintf(buff, "%c:\\AUTOEXEC.BAT", targetdrv);
|
298 |
fd = fopen(buff, "wb");
|
307 |
fd = fopen(buff, "wb");
|
299 |
if (fd == NULL) return;
|
308 |
if (fd == NULL) return;
|
300 |
fprintf(fd, "@ECHO OFF\r\n");
|
309 |
fprintf(fd, "@ECHO OFF\r\n");
|
301 |
fprintf(fd, "SET TEMP=%c:\\TEMP\r\n", drv);
|
310 |
fprintf(fd, "SET TEMP=%c:\\TEMP\r\n", targetdrv);
|
302 |
fprintf(fd, "SET DOSDIR=%c:\\SYSTEM\\SVAROG.386\r\n", drv);
|
311 |
fprintf(fd, "SET DOSDIR=%c:\\SYSTEM\\SVAROG.386\r\n", targetdrv);
|
303 |
fprintf(fd, "SET NLSPATH=%%DOSDIR%%\\NLS\r\n", drv);
|
312 |
fprintf(fd, "SET NLSPATH=%%DOSDIR%%\\NLS\r\n", targetdrv);
|
304 |
fprintf(fd, "SET LANG=%s\r\n", lang);
|
313 |
fprintf(fd, "SET LANG=%s\r\n", lang);
|
305 |
fprintf(fd, "SET DIRCMD=/OGNE/P\r\n");
|
314 |
fprintf(fd, "SET DIRCMD=/OGNE/P\r\n");
|
306 |
fprintf(fd, "SET FDNPKG.CFG=%c:\\SYSTEM\\CFG\\FDNPKG.CFG\r\n");
|
315 |
fprintf(fd, "SET FDNPKG.CFG=%c:\\SYSTEM\\CFG\\FDNPKG.CFG\r\n");
|
307 |
fprintf(fd, "SET WATTCP.CFG=%c:\\SYSTEM\\CFG\\WATTCP.CFG\r\n");
|
316 |
fprintf(fd, "SET WATTCP.CFG=%c:\\SYSTEM\\CFG\\WATTCP.CFG\r\n");
|
308 |
fprintf(fd, "PATH %%DOSDIR%%\\BIN;%%DOSDIR%%\\LINKS\r\n");
|
317 |
fprintf(fd, "PATH %%DOSDIR%%\\BIN;%%DOSDIR%%\\LINKS\r\n");
|
Line 314... |
Line 323... |
314 |
fprintf(fd, "MODE CON CP SELECT=991\r\n");
|
323 |
fprintf(fd, "MODE CON CP SELECT=991\r\n");
|
315 |
fprintf(fd, "\r\n");
|
324 |
fprintf(fd, "\r\n");
|
316 |
fprintf(fd, "SHSUCDX /d:FDCD0001\r\n");
|
325 |
fprintf(fd, "SHSUCDX /d:FDCD0001\r\n");
|
317 |
fclose(fd);
|
326 |
fclose(fd);
|
318 |
/*** CONFIG.SYS ***/
|
327 |
/*** CONFIG.SYS ***/
|
319 |
sprintf(buff, "%c:\\CONFIG.SYS", drv);
|
328 |
sprintf(buff, "%c:\\CONFIG.SYS", targetdrv);
|
320 |
fd = fopen(buff, "wb");
|
329 |
fd = fopen(buff, "wb");
|
321 |
if (fd == NULL) return;
|
330 |
if (fd == NULL) return;
|
322 |
fprintf(fd, "DOS=UMB,HIGH\r\n");
|
331 |
fprintf(fd, "DOS=UMB,HIGH\r\n");
|
323 |
fprintf(fd, "FILES=50\r\n");
|
332 |
fprintf(fd, "FILES=50\r\n");
|
324 |
fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\HIMEM.EXE\r\n", drv);
|
333 |
fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\HIMEM.EXE\r\n", targetdrv);
|
325 |
fprintf(fd, "SHELLHIGH=%c:\\SYSTEM\\SVAROG.386\\BIN\\COMMAND.COM /E:512", drv);
|
334 |
fprintf(fd, "SHELLHIGH=%c:\\SYSTEM\\SVAROG.386\\BIN\\COMMAND.COM /E:512", targetdrv);
|
326 |
fprintf(fd, "REM COUNTRY=001,437,%c:\\SYSTEM\\SVAROG.386\r\n", drv);
|
335 |
fprintf(fd, "REM COUNTRY=001,437,%c:\\SYSTEM\\SVAROG.386\r\n", targetdrv);
|
327 |
fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\CDROM.SYS /D:FDCD0001\r\n", drv);
|
336 |
fprintf(fd, "DEVICE=%c:\\SYSTEM\\SVAROG.386\\BIN\\CDROM.SYS /D:FDCD0001\r\n", targetdrv);
|
328 |
fclose(fd);
|
337 |
fclose(fd);
|
329 |
}
|
338 |
}
|
330 |
|
339 |
|
331 |
|
340 |
|
332 |
static void installpackages(void) {
|
341 |
static void installpackages(void) {
|
Line 387... |
Line 396... |
387 |
newscreen();
|
396 |
newscreen();
|
388 |
/* count how long the pkg list is */
|
397 |
/* count how long the pkg list is */
|
389 |
for (pkglistlen = 0; pkglist[pkglistlen] != NULL; pkglistlen++);
|
398 |
for (pkglistlen = 0; pkglist[pkglistlen] != NULL; pkglistlen++);
|
390 |
/* install packages */
|
399 |
/* install packages */
|
391 |
for (i = 0; pkglist[i] != NULL; i++) {
|
400 |
for (i = 0; pkglist[i] != NULL; i++) {
|
392 |
char buff[16];
|
401 |
char buff[128];
|
393 |
sprintf(buff, "Installing package %d/%d: %s", i+1, pkglistlen, pkglist[i]);
|
402 |
sprintf(buff, "Installing package %d/%d: %s", i+1, pkglistlen, pkglist[i]);
|
- |
|
403 |
strcat(buff, " ");
|
394 |
video_putstring(10, 2, COLOR_BODY[mono], buff);
|
404 |
video_putstring(10, 2, COLOR_BODY[mono], buff);
|
395 |
sprintf(buff, "FDNPKG INSTALL %s > NULL");
|
405 |
sprintf(buff, "FDNPKG INSTALL %s > NUL");
|
396 |
system(buff);
|
406 |
system(buff);
|
397 |
}
|
407 |
}
|
398 |
}
|
408 |
}
|
399 |
|
409 |
|
400 |
|
410 |
|