Subversion Repositories SvarDOS

Rev

Rev 78 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 78 Rev 79
Line 162... Line 162...
162
      video_putstring(1, 0, COLOR_BODY[mono], buf, -1);
162
      video_putstring(1, 0, COLOR_BODY[mono], buf, -1);
163
    }*/
163
    }*/
164
  }
164
  }
165
}
165
}
166
 
166
 
167
static void newscreen(void) {
167
static void newscreen(int statusbartype) {
168
  int x;
168
  int x;
169
  char *title;
169
  char *msg;
170
  title = kittengets(0, 0, "SVAROG386 INSTALLATION");
170
  msg = kittengets(0, 0, "SVAROG386 INSTALLATION");
171
  for (x = 0; x < 80; x++) video_putchar(0, x, COLOR_TITLEBAR[mono], ' ');
171
  for (x = 0; x < 80; x++) video_putchar(0, x, COLOR_TITLEBAR[mono], ' ');
172
  video_putstring(0, 40 - (strlen(title) >> 1), COLOR_TITLEBAR[mono], title, -1);
172
  video_putstring(0, 40 - (strlen(msg) >> 1), COLOR_TITLEBAR[mono], msg, -1);
173
  video_clear(COLOR_BODY[mono], 80);
173
  video_clear(COLOR_BODY[mono], 80);
-
 
174
  switch (statusbartype) {
-
 
175
    case 1:
-
 
176
      msg = kittengets(0, 11, "Up/Down = Select entry | Enter = Validate your choice | ESC = Quit to DOS");
-
 
177
      break;
-
 
178
    case 2:
-
 
179
      msg = kittengets(0, 5, "Press any key...");
-
 
180
      break;
-
 
181
    case 3:
-
 
182
      msg = "";
-
 
183
      break;
-
 
184
    default:
-
 
185
      msg = kittengets(0, 10, "Up/Down = Select entry | Enter = Validate your choice | ESC = Previous screen");
-
 
186
      break;
-
 
187
  }
-
 
188
  video_putchar(24, 0, COLOR_TITLEBAR[mono], ' ');
-
 
189
  video_putstringfix(24, 1, COLOR_TITLEBAR[mono], msg, 79);
174
  video_movecursor(25,0);
190
  video_movecursor(25,0);
175
}
191
}
176
 
192
 
177
static int selectlang(struct slocales *locales) {
193
static int selectlang(struct slocales *locales) {
178
  int choice, x;
194
  int choice, x;
Line 183... Line 199...
183
    "Polish",
199
    "Polish",
184
    "Turkish",
200
    "Turkish",
185
    NULL
201
    NULL
186
  };
202
  };
187
 
203
 
188
  newscreen();
204
  newscreen(1);
189
  msg = kittengets(1, 0, "Welcome to Svarog386");
205
  msg = kittengets(1, 0, "Welcome to Svarog386");
190
  x = 40 - (strlen(msg) >> 1);
206
  x = 40 - (strlen(msg) >> 1);
191
  video_putstring(4, x, COLOR_BODY[mono], msg, -1);
207
  video_putstring(4, x, COLOR_BODY[mono], msg, -1);
192
  video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
208
  video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
193
  putstringnls(8, -1, COLOR_BODY[mono], 1, 1, "Please select your language from the list below:");
209
  putstringnls(8, -1, COLOR_BODY[mono], 1, 1, "Please select your language from the list below:");
Line 255... Line 271...
255
      keyboff = 0;
271
      keyboff = 0;
256
      keyblen = OFFCOUNT;
272
      keyblen = OFFCOUNT;
257
      break;
273
      break;
258
  }
274
  }
259
  if (keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
275
  if (keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
260
  newscreen();
276
  newscreen(0);
261
  putstringnls(5, 1, COLOR_BODY[mono], 1, 5, "Svarog386 supports the keyboard layouts used in different countries. Choose the keyboard layout you want.");
277
  putstringnls(5, 1, COLOR_BODY[mono], 1, 5, "Svarog386 supports the keyboard layouts used in different countries. Choose the keyboard layout you want.");
262
  menuheight = keyblen + 2;
278
  menuheight = keyblen + 2;
263
  if (menuheight > 13) menuheight = 13;
279
  if (menuheight > 13) menuheight = 13;
264
  if (menuselect(10, -1, menuheight, &(kblayouts[keyboff]), keyblen) < 0) return(MENUPREV);
280
  if (menuselect(10, -1, menuheight, &(kblayouts[keyboff]), keyblen) < 0) return(MENUPREV);
265
  return(MENUNEXT);
281
  return(MENUNEXT);
Line 270... Line 286...
270
static int welcomescreen(void) {
286
static int welcomescreen(void) {
271
  int c;
287
  int c;
272
  char *choice[] = {"Install Svarog386 to disk", "Quit to DOS", NULL};
288
  char *choice[] = {"Install Svarog386 to disk", "Quit to DOS", NULL};
273
  choice[0] = kittengets(0, 1, choice[0]);
289
  choice[0] = kittengets(0, 1, choice[0]);
274
  choice[1] = kittengets(0, 2, choice[1]);
290
  choice[1] = kittengets(0, 2, choice[1]);
275
  newscreen();
291
  newscreen(0);
276
  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.");
292
  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.");
277
  c = menuselect(13, -1, 4, choice, -1);
293
  c = menuselect(13, -1, 4, choice, -1);
278
  if (c < 0) return(MENUPREV);
294
  if (c < 0) return(MENUPREV);
279
  if (c == 0) return(MENUNEXT);
295
  if (c == 0) return(MENUNEXT);
280
  return(MENUQUIT);
296
  return(MENUQUIT);
Line 335... Line 351...
335
  int ds;
351
  int ds;
336
  int choice;
352
  int choice;
337
  char buff[1024];
353
  char buff[1024];
338
  cselecteddrive = 'A' + selecteddrive - 1;
354
  cselecteddrive = 'A' + selecteddrive - 1;
339
  for (;;) {
355
  for (;;) {
340
    newscreen();
-
 
341
    driveremovable = isdriveremovable(selecteddrive);
356
    driveremovable = isdriveremovable(selecteddrive);
342
    if (driveremovable < 0) {
357
    if (driveremovable < 0) {
343
      char *list[] = { "Create a partition automatically", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
358
      char *list[] = { "Create a partition automatically", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
-
 
359
      newscreen(0);
344
      list[0] = kittengets(0, 3, list[0]);
360
      list[0] = kittengets(0, 3, list[0]);
345
      list[1] = kittengets(0, 4, list[1]);
361
      list[1] = kittengets(0, 4, list[1]);
346
      list[2] = kittengets(0, 2, list[2]);
362
      list[2] = kittengets(0, 2, list[2]);
347
      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);
363
      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);
348
      putstringwrap(4, 1, COLOR_BODY[mono], buff);
364
      putstringwrap(4, 1, COLOR_BODY[mono], buff);
Line 358... Line 374...
358
        case 2:
374
        case 2:
359
          return(MENUQUIT);
375
          return(MENUQUIT);
360
        default:
376
        default:
361
          return(-1);
377
          return(-1);
362
      }
378
      }
363
      newscreen();
379
      newscreen(2);
364
      putstringnls(10, 10, COLOR_BODY[mono], 3, 1, "Your computer will reboot now.");
380
      putstringnls(10, 10, COLOR_BODY[mono], 3, 1, "Your computer will reboot now.");
365
      putstringnls(12, 10, COLOR_BODY[mono], 0, 5, "Press any key...");
381
      putstringnls(12, 10, COLOR_BODY[mono], 0, 5, "Press any key...");
366
      input_getkey();
382
      input_getkey();
367
      reboot();
383
      reboot();
368
      return(MENUQUIT);
384
      return(MENUQUIT);
369
    } else if (driveremovable > 0) {
385
    } else if (driveremovable > 0) {
-
 
386
      newscreen(2);
370
      snprintf(buff, sizeof(buff), kittengets(3, 2, "ERROR: Drive %c: is a removable device. Installation aborted."), cselecteddrive);
387
      snprintf(buff, sizeof(buff), kittengets(3, 2, "ERROR: Drive %c: is a removable device. Installation aborted."), cselecteddrive);
371
      video_putstring(9, 1, COLOR_BODY[mono], buff, -1);
388
      video_putstring(9, 1, COLOR_BODY[mono], buff, -1);
372
      putstringnls(11, 2, COLOR_BODY[mono], 0, 5, "Press any key...");
389
      putstringnls(11, 2, COLOR_BODY[mono], 0, 5, "Press any key...");
373
      return(MENUQUIT);
390
      return(MENUQUIT);
374
    }
391
    }
Line 376... Line 393...
376
    snprintf(buff, sizeof(buff), "%c:\\SVWRTEST.123", cselecteddrive);
393
    snprintf(buff, sizeof(buff), "%c:\\SVWRTEST.123", cselecteddrive);
377
    if (mkdir(buff) == 0) {
394
    if (mkdir(buff) == 0) {
378
      rmdir(buff);
395
      rmdir(buff);
379
    } else {
396
    } else {
380
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
397
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
-
 
398
      newscreen(0);
381
      list[0] = kittengets(0, 6, list[0]);
399
      list[0] = kittengets(0, 6, list[0]);
382
      list[1] = kittengets(0, 2, list[1]);
400
      list[1] = kittengets(0, 2, list[1]);
383
      snprintf(buff, sizeof(buff), kittengets(3, 3, "ERROR: Drive %c: seems to be unformated. Do you wish to format it?"), cselecteddrive);
401
      snprintf(buff, sizeof(buff), kittengets(3, 3, "ERROR: Drive %c: seems to be unformated. Do you wish to format it?"), cselecteddrive);
384
      video_putstring(7, 1, COLOR_BODY[mono], buff, -1);
402
      video_putstring(7, 1, COLOR_BODY[mono], buff, -1);
385
      choice = menuselect(12, -1, 4, list, -1);
403
      choice = menuselect(12, -1, 4, list, -1);
Line 393... Line 411...
393
    }
411
    }
394
    /* check total disk space */
412
    /* check total disk space */
395
    ds = disksize(selecteddrive);
413
    ds = disksize(selecteddrive);
396
    if (ds < SVAROG_DISK_REQ) {
414
    if (ds < SVAROG_DISK_REQ) {
397
      int y = 9;
415
      int y = 9;
-
 
416
      newscreen(2);
398
      snprintf(buff, sizeof(buff), kittengets(3, 4, "ERROR: Drive %c: is not big enough! Svarog386 requires a disk of at least %d MiB."), cselecteddrive);
417
      snprintf(buff, sizeof(buff), kittengets(3, 4, "ERROR: Drive %c: is not big enough! Svarog386 requires a disk of at least %d MiB."), cselecteddrive);
399
      y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
418
      y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
400
      putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
419
      putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
401
      input_getkey();
420
      input_getkey();
402
      return(MENUQUIT);
421
      return(MENUQUIT);
403
    }
422
    }
404
    /* is the disk empty? */
423
    /* is the disk empty? */
-
 
424
    newscreen(0);
405
    if (diskempty(selecteddrive) != 0) {
425
    if (diskempty(selecteddrive) != 0) {
406
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
426
      char *list[] = { "Proceed with formatting", "Quit to DOS", NULL};
407
      int y = 6;
427
      int y = 6;
408
      list[0] = kittengets(0, 6, list[0]);
428
      list[0] = kittengets(0, 6, list[0]);
409
      list[1] = kittengets(0, 2, list[1]);
429
      list[1] = kittengets(0, 2, list[1]);
Line 591... Line 611...
591
    "XCOPY",
611
    "XCOPY",
592
    NULL
612
    NULL
593
  };
613
  };
594
  int i, pkglistlen;
614
  int i, pkglistlen;
595
  char buff[64];
615
  char buff[64];
596
  newscreen();
616
  newscreen(3);
597
  /* count how long the pkg list is */
617
  /* count how long the pkg list is */
598
  for (pkglistlen = 0; pkglist[pkglistlen] != NULL; pkglistlen++);
618
  for (pkglistlen = 0; pkglist[pkglistlen] != NULL; pkglistlen++);
599
  /* set DOSDIR and friends */
619
  /* set DOSDIR and friends */
600
  snprintf(buff, sizeof(buff), "%c:\\SYSTEM\\SVAROG.386", targetdrv);
620
  snprintf(buff, sizeof(buff), "%c:\\SYSTEM\\SVAROG.386", targetdrv);
601
  setenv("DOSDIR", buff, 1);
621
  setenv("DOSDIR", buff, 1);
Line 617... Line 637...
617
}
637
}
618
 
638
 
619
 
639
 
620
static void finalreboot(void) {
640
static void finalreboot(void) {
621
  int y = 9;
641
  int y = 9;
622
  newscreen();
642
  newscreen(2);
623
  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.");
643
  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.");
624
  putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
644
  putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
625
  input_getkey();
645
  input_getkey();
626
  reboot();
646
  reboot();
627
}
647
}