Subversion Repositories SvarDOS

Rev

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

Rev 619 Rev 624
Line 1... Line 1...
1
/*
1
/*
2
 * SVARDOS INSTALL PROGRAM
2
 * SVARDOS INSTALL PROGRAM
3
 * Copyright (C) 2021 Mateusz Viste
-
 
4
 *
3
 *
5
 * PUBLISHED UNDER THE TERMS OF THE MIT LICENSE
4
 * PUBLISHED UNDER THE TERMS OF THE MIT LICENSE
6
 *
5
 *
7
 * COPYRIGHT (C) 2016-2021 MATEUSZ VISTE, ALL RIGHTS RESERVED.
6
 * COPYRIGHT (C) 2016-2022 MATEUSZ VISTE, ALL RIGHTS RESERVED.
8
 *
7
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a
8
 * Permission is hereby granted, free of charge, to any person obtaining a
10
 * copy of this software and associated documentation files (the "Software"),
9
 * copy of this software and associated documentation files (the "Software"),
11
 * to deal in the Software without restriction, including without limitation
10
 * to deal in the Software without restriction, including without limitation
12
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Line 32... Line 31...
32
#include <stdio.h>   /* printf() and friends */
31
#include <stdio.h>   /* printf() and friends */
33
#include <stdlib.h>  /* system() */
32
#include <stdlib.h>  /* system() */
34
#include <string.h>  /* memcpy() */
33
#include <string.h>  /* memcpy() */
35
#include <unistd.h>
34
#include <unistd.h>
36
 
35
 
37
#include "kitten\kitten.h"
36
#include "svarlang.lib\svarlang.h"
38
 
37
 
39
#include "input.h"
38
#include "input.h"
40
#include "video.h"
39
#include "video.h"
41
 
40
 
42
/* keyboard layouts and locales */
41
/* keyboard layouts and locales */
Line 63... Line 62...
63
/* a convenience 'function' used for debugging */
62
/* a convenience 'function' used for debugging */
64
#define DBG(x) { video_putstringfix(24, 0, 0x4F00u, x, 80); }
63
#define DBG(x) { video_putstringfix(24, 0, 0x4F00u, x, 80); }
65
 
64
 
66
struct slocales {
65
struct slocales {
67
  char lang[4];
66
  char lang[4];
68
  char *keybcode;
67
  const char *keybcode;
69
  unsigned int codepage;
68
  unsigned int codepage;
70
  int egafile;
69
  int egafile;
71
  int keybfile;
70
  int keybfile;
72
  int keyboff;
71
  int keyboff;
73
  int keyblen;
72
  int keyblen;
Line 83... Line 82...
83
  (*bootroutine)(); /* jump to the BIOS reboot routine at FFFF:0000 */
82
  (*bootroutine)(); /* jump to the BIOS reboot routine at FFFF:0000 */
84
}
83
}
85
 
84
 
86
 
85
 
87
/* outputs a string to screen with taking care of word wrapping. returns amount of lines. */
86
/* outputs a string to screen with taking care of word wrapping. returns amount of lines. */
88
static int putstringwrap(int y, int x, unsigned short attr, char *s) {
87
static int putstringwrap(int y, int x, unsigned short attr, const char *s) {
89
  int linew, lincount;
88
  int linew, lincount;
90
  linew = 80;
89
  linew = 80;
91
  if (x >= 0) linew -= (x << 1);
90
  if (x >= 0) linew -= (x << 1);
92
 
91
 
93
  for (lincount = 1; y+lincount < 25; lincount++) {
92
  for (lincount = 1; y+lincount < 25; lincount++) {
Line 112... Line 111...
112
}
111
}
113
 
112
 
114
 
113
 
115
/* an NLS wrapper around video_putstring(), also performs line wrapping when
114
/* an NLS wrapper around video_putstring(), also performs line wrapping when
116
 * needed. returns the amount of lines that were output */
115
 * needed. returns the amount of lines that were output */
117
static int putstringnls(int y, int x, unsigned short attr, int nlsmaj, int nlsmin, char *s) {
116
static int putstringnls(int y, int x, unsigned short attr, int nlsmaj, int nlsmin) {
118
  s = kittengets(nlsmaj, nlsmin, s);
117
  const char *s = svarlang_str(nlsmaj, nlsmin);
-
 
118
  if (s == NULL) s = "";
119
  return(putstringwrap(y, x, attr, s));
119
  return(putstringwrap(y, x, attr, s));
120
}
120
}
121
 
121
 
122
 
122
 
123
/* copy file f1 to f2 using buff as a buffer of buffsz bytes. f2 will be overwritten if it
123
/* copy file f1 to f2 using buff as a buffer of buffsz bytes. f2 will be overwritten if it
Line 149... Line 149...
149
  if (fd2 != NULL) fclose(fd2);
149
  if (fd2 != NULL) fclose(fd2);
150
  return(res);
150
  return(res);
151
}
151
}
152
 
152
 
153
 
153
 
154
static int menuselect(int ypos, int xpos, int height, char **list, int listlen) {
154
static int menuselect(int ypos, int xpos, int height, const char **list, int listlen) {
155
  int i, offset = 0, res = 0, count, width = 0;
155
  int i, offset = 0, res = 0, count, width = 0;
156
  /* count how many positions there is, and check their width */
156
  /* count how many positions there is, and check their width */
157
  for (count = 0; (list[count] != NULL) && (count != listlen); count++) {
157
  for (count = 0; (list[count] != NULL) && (count != listlen); count++) {
158
    int len = strlen(list[count]);
158
    int len = strlen(list[count]);
159
    if (len > width) width = len;
159
    if (len > width) width = len;
Line 216... Line 216...
216
    }*/
216
    }*/
217
  }
217
  }
218
}
218
}
219
 
219
 
220
static void newscreen(int statusbartype) {
220
static void newscreen(int statusbartype) {
221
  char *msg;
221
  const char *msg;
222
  msg = kittengets(0, 0, "SVARDOS INSTALLATION");
222
  msg = svarlang_strid(0x00); /* "SVARDOS INSTALLATION" */
223
  video_putcharmulti(0, 0, COLOR_TITLEBAR[mono], ' ', 80, 1);
223
  video_putcharmulti(0, 0, COLOR_TITLEBAR[mono], ' ', 80, 1);
224
  video_putstring(0, 40 - (strlen(msg) >> 1), COLOR_TITLEBAR[mono], msg, -1);
224
  video_putstring(0, 40 - (strlen(msg) >> 1), COLOR_TITLEBAR[mono], msg, -1);
225
  video_clear(COLOR_BODY[mono], 80, -80);
225
  video_clear(COLOR_BODY[mono], 80, -80);
226
  switch (statusbartype) {
226
  switch (statusbartype) {
227
    case 1:
227
    case 1:
228
      msg = kittengets(0, 11, "Up/Down = Select entry | Enter = Validate your choice | ESC = Quit to DOS");
228
      msg = svarlang_strid(0x000B); /* "Up/Down = Select entry | Enter = Validate your choice | ESC = Quit to DOS" */
229
      break;
229
      break;
230
    case 2:
230
    case 2:
231
      msg = kittengets(0, 5, "Press any key...");
231
      msg = svarlang_strid(0x0005); /* "Press any key..." */
232
      break;
232
      break;
233
    case 3:
233
    case 3:
234
      msg = "";
234
      msg = "";
235
      break;
235
      break;
236
    default:
236
    default:
237
      msg = kittengets(0, 10, "Up/Down = Select entry | Enter = Validate your choice | ESC = Previous screen");
237
      msg = svarlang_strid(0x000A); /* "Up/Down = Select entry | Enter = Validate your choice | ESC = Previous screen" */
238
      break;
238
      break;
239
  }
239
  }
240
  video_putchar(24, 0, COLOR_TITLEBAR[mono], ' ');
240
  video_putchar(24, 0, COLOR_TITLEBAR[mono], ' ');
241
  video_putstringfix(24, 1, COLOR_TITLEBAR[mono], msg, 79);
241
  video_putstringfix(24, 1, COLOR_TITLEBAR[mono], msg, 79);
242
  video_movecursor(25,0);
242
  video_movecursor(25,0);
243
}
243
}
244
 
244
 
245
/* fills a slocales struct accordingly to the value of its keyboff member */
245
/* fills a slocales struct accordingly to the value of its keyboff member */
246
static void kblay2slocal(struct slocales *locales) {
246
static void kblay2slocal(struct slocales *locales) {
247
  char *m;
247
  const char *m;
248
  for (m = kblayouts[locales->keyboff]; *m != 0; m++); /* skip layout name */
248
  for (m = kblayouts[locales->keyboff]; *m != 0; m++); /* skip layout name */
249
  m++;
249
  m++;
250
  /* skip keyb code and copy it to locales.keybcode */
250
  /* skip keyb code and copy it to locales.keybcode */
251
  locales->keybcode = m;
251
  locales->keybcode = m;
252
  for (; *m != 0; m++);
252
  for (; *m != 0; m++);
Line 257... Line 257...
257
  locales->keybid = ((unsigned short)m[5] << 8) | m[6];
257
  locales->keybid = ((unsigned short)m[5] << 8) | m[6];
258
}
258
}
259
 
259
 
260
static int selectlang(struct slocales *locales) {
260
static int selectlang(struct slocales *locales) {
261
  int choice, x;
261
  int choice, x;
262
  char *msg;
262
  const char *msg;
263
  char *langlist[] = {
263
  const char *langlist[] = {
264
    "English",
264
    "English",
265
    "French",
265
    "French",
266
    "German",
266
    "German",
267
    "Italian",
267
    "Italian",
268
    "Polish",
268
    "Polish",
Line 272... Line 272...
272
    "Turkish",
272
    "Turkish",
273
    NULL
273
    NULL
274
  };
274
  };
275
 
275
 
276
  newscreen(1);
276
  newscreen(1);
277
  msg = kittengets(1, 0, "Welcome to SvarDOS");
277
  msg = svarlang_strid(0x0100); /* "Welcome to SvarDOS" */
278
  x = 40 - (strlen(msg) >> 1);
278
  x = 40 - (strlen(msg) >> 1);
279
  video_putstring(4, x, COLOR_BODY[mono], msg, -1);
279
  video_putstring(4, x, COLOR_BODY[mono], msg, -1);
280
  video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
280
  video_putcharmulti(5, x, COLOR_BODY[mono], '=', strlen(msg), 1);
281
  putstringnls(8, -1, COLOR_BODY[mono], 1, 1, "Please select your language from the list below:");
281
  putstringnls(8, -1, COLOR_BODY[mono], 1, 1); /* "Please select your language from the list below:" */
282
  choice = menuselect(11, -1, 11, langlist, -1);
282
  choice = menuselect(11, -1, 11, langlist, -1);
283
  if (choice < 0) return(MENUPREV);
283
  if (choice < 0) return(MENUPREV);
284
  /* populate locales with default values */
284
  /* populate locales with default values */
285
  memset(locales, 0, sizeof(struct slocales));
285
  memset(locales, 0, sizeof(struct slocales));
286
  switch (choice) {
286
  switch (choice) {
Line 339... Line 339...
339
 
339
 
340
static int selectkeyb(struct slocales *locales) {
340
static int selectkeyb(struct slocales *locales) {
341
  int menuheight, choice;
341
  int menuheight, choice;
342
  if (locales->keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
342
  if (locales->keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
343
  newscreen(0);
343
  newscreen(0);
344
  putstringnls(5, 1, COLOR_BODY[mono], 1, 5, "SvarDOS supports different keyboard layouts. Choose the keyboard layout that you want.");
344
  putstringnls(5, 1, COLOR_BODY[mono], 1, 5); /* "SvarDOS supports different keyboard layouts */
345
  menuheight = locales->keyblen + 2;
345
  menuheight = locales->keyblen + 2;
346
  if (menuheight > 13) menuheight = 13;
346
  if (menuheight > 13) menuheight = 13;
347
  choice = menuselect(10, -1, menuheight, &(kblayouts[locales->keyboff]), locales->keyblen);
347
  choice = menuselect(10, -1, menuheight, &(kblayouts[locales->keyboff]), locales->keyblen);
348
  if (choice < 0) return(MENUPREV);
348
  if (choice < 0) return(MENUPREV);
349
  /* (re)load the keyboard layout & codepage setup */
349
  /* (re)load the keyboard layout & codepage setup */
Line 354... Line 354...
354
 
354
 
355
 
355
 
356
/* returns 0 if installation must proceed, non-zero otherwise */
356
/* returns 0 if installation must proceed, non-zero otherwise */
357
static int welcomescreen(void) {
357
static int welcomescreen(void) {
358
  int c;
358
  int c;
359
  char *choice[] = {"Install SvarDOS to disk", "Quit to DOS", NULL};
359
  const char *choice[3];
360
  choice[0] = kittengets(0, 1, choice[0]);
360
  choice[0] = svarlang_strid(0x0001);
361
  choice[1] = kittengets(0, 2, choice[1]);
361
  choice[1] = svarlang_strid(0x0002);
-
 
362
  choice[2] = NULL;
362
  newscreen(0);
363
  newscreen(0);
363
  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.");
364
  putstringnls(4, 1, COLOR_BODY[mono], 2, 0); /* "You are about to install SvarDOS */
364
  c = menuselect(13, -1, 4, choice, -1);
365
  c = menuselect(13, -1, 4, choice, -1);
365
  if (c < 0) return(MENUPREV);
366
  if (c < 0) return(MENUPREV);
366
  if (c == 0) return(MENUNEXT);
367
  if (c == 0) return(MENUNEXT);
367
  return(MENUQUIT);
368
  return(MENUQUIT);
368
}
369
}
Line 461... Line 462...
461
  }
462
  }
462
  cselecteddrive = 'A' + selecteddrive - 1;
463
  cselecteddrive = 'A' + selecteddrive - 1;
463
  for (;;) {
464
  for (;;) {
464
    driveremovable = isdriveremovable(selecteddrive);
465
    driveremovable = isdriveremovable(selecteddrive);
465
    if (driveremovable < 0) {
466
    if (driveremovable < 0) {
466
      char *list[] = { "Create a partition automatically", "Run the FDISK partitioning tool", "Quit to DOS", NULL};
467
      const char *list[4];
467
      newscreen(0);
468
      newscreen(0);
468
      list[0] = kittengets(0, 3, list[0]);
469
      list[0] = svarlang_str(0, 3); /* Create a partition automatically */
469
      list[1] = kittengets(0, 4, list[1]);
470
      list[1] = svarlang_str(0, 4); /* Run the FDISK tool */
470
      list[2] = kittengets(0, 2, list[2]);
471
      list[2] = svarlang_str(0, 2); /* Quit to DOS */
-
 
472
      list[3] = NULL;
471
      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);
473
      snprintf(buff, sizeof(buff), svarlang_strid(0x0300), cselecteddrive, SVARDOS_DISK_REQ); /* "ERROR: Drive %c: could not be found. Note, that SvarDOS requires at least %d MiB of available disk space */
472
      switch (menuselect(6 + putstringwrap(4, 1, COLOR_BODY[mono], buff), -1, 5, list, -1)) {
474
      switch (menuselect(6 + putstringwrap(4, 1, COLOR_BODY[mono], buff), -1, 5, list, -1)) {
473
        case 0:
475
        case 0:
474
          sprintf(buff, "FDISK /AUTO %d", driveid);
476
          sprintf(buff, "FDISK /AUTO %d", driveid);
475
          system(buff);
477
          system(buff);
476
          break;
478
          break;
Line 488... Line 490...
488
      /* write a temporary MBR which only skips the drive (in case BIOS would
490
      /* write a temporary MBR which only skips the drive (in case BIOS would
489
       * try to boot off the not-yet-ready C: disk) */
491
       * try to boot off the not-yet-ready C: disk) */
490
      sprintf(buff, "FDISK /AMBR %d", driveid);
492
      sprintf(buff, "FDISK /AMBR %d", driveid);
491
      system(buff); /* writes BOOT.MBR into actual MBR */
493
      system(buff); /* writes BOOT.MBR into actual MBR */
492
      newscreen(2);
494
      newscreen(2);
493
      putstringnls(10, 10, COLOR_BODY[mono], 3, 1, "Your computer will reboot now.");
495
      putstringnls(10, 10, COLOR_BODY[mono], 3, 1); /* "Your computer will reboot now." */
494
      putstringnls(12, 10, COLOR_BODY[mono], 0, 5, "Press any key...");
496
      putstringnls(12, 10, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
495
      input_getkey();
497
      input_getkey();
496
      reboot();
498
      reboot();
497
      return(MENUQUIT);
499
      return(MENUQUIT);
498
    } else if (driveremovable > 0) {
500
    } else if (driveremovable > 0) {
499
      newscreen(2);
501
      newscreen(2);
500
      snprintf(buff, sizeof(buff), kittengets(3, 2, "ERROR: Drive %c: is a removable device. Installation aborted."), cselecteddrive);
502
      snprintf(buff, sizeof(buff), svarlang_strid(0x0302), cselecteddrive); /* "ERROR: Drive %c: is a removable device */
501
      video_putstring(9, 1, COLOR_BODY[mono], buff, -1);
503
      video_putstring(9, 1, COLOR_BODY[mono], buff, -1);
502
      putstringnls(11, 2, COLOR_BODY[mono], 0, 5, "Press any key...");
504
      putstringnls(11, 2, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
503
      return(MENUQUIT);
505
      return(MENUQUIT);
504
    }
506
    }
505
    /* if not formatted, propose to format it right away (try to create a directory) */
507
    /* if not formatted, propose to format it right away (try to create a directory) */
506
    snprintf(buff, sizeof(buff), "%c:\\SVWRTEST.123", cselecteddrive);
508
    snprintf(buff, sizeof(buff), "%c:\\SVWRTEST.123", cselecteddrive);
507
    if (mkdir(buff) == 0) {
509
    if (mkdir(buff) == 0) {
508
      rmdir(buff);
510
      rmdir(buff);
509
    } else {
511
    } else {
510
      char *list[3];
512
      const char *list[3];
511
      newscreen(0);
513
      newscreen(0);
512
      snprintf(buff, sizeof(buff), kittengets(3, 3, "ERROR: Drive %c: seems to be unformated. Do you wish to format it?"), cselecteddrive);
514
      snprintf(buff, sizeof(buff), svarlang_str(3, 3), cselecteddrive); /* "ERROR: Drive %c: seems to be unformated. Do you wish to format it?") */
513
      video_putstring(7, 1, COLOR_BODY[mono], buff, -1);
515
      video_putstring(7, 1, COLOR_BODY[mono], buff, -1);
514
 
516
 
515
      snprintf(buff, sizeof(buff), kittengets(0, 7, "Format drive %c:"), cselecteddrive);
517
      snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
516
      list[0] = buff;
518
      list[0] = buff;
517
      list[1] = kittengets(0, 2, "Quit to DOS");
519
      list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
518
      list[2] = NULL;
520
      list[2] = NULL;
519
 
521
 
520
      choice = menuselect(12, -1, 4, list, -1);
522
      choice = menuselect(12, -1, 4, list, -1);
521
      if (choice < 0) return(MENUPREV);
523
      if (choice < 0) return(MENUPREV);
522
      if (choice == 1) return(MENUQUIT);
524
      if (choice == 1) return(MENUQUIT);
Line 529... Line 531...
529
    /* check total disk space */
531
    /* check total disk space */
530
    ds = disksize(selecteddrive);
532
    ds = disksize(selecteddrive);
531
    if (ds < SVARDOS_DISK_REQ) {
533
    if (ds < SVARDOS_DISK_REQ) {
532
      int y = 9;
534
      int y = 9;
533
      newscreen(2);
535
      newscreen(2);
534
      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);
536
      snprintf(buff, sizeof(buff), svarlang_strid(0x0304), cselecteddrive, SVARDOS_DISK_REQ); /* "ERROR: Drive %c: is not big enough! SvarDOS requires a disk of at least %d MiB." */
535
      y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
537
      y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
536
      putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
538
      putstringnls(++y, 1, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
537
      input_getkey();
539
      input_getkey();
538
      return(MENUQUIT);
540
      return(MENUQUIT);
539
    }
541
    }
540
    /* is the disk empty? */
542
    /* is the disk empty? */
541
    newscreen(0);
543
    newscreen(0);
542
    if (diskempty(selecteddrive) != 0) {
544
    if (diskempty(selecteddrive) != 0) {
543
      char *list[3];
545
      const char *list[3];
544
      int y = 6;
546
      int y = 6;
545
      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);
547
      snprintf(buff, sizeof(buff), svarlang_strid(0x0305), cselecteddrive); /* "ERROR: Drive %c: not empty" */
546
      y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
548
      y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
547
 
549
 
548
      snprintf(buff, sizeof(buff), kittengets(0, 7, "Format drive %c:"), cselecteddrive);
550
      snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
549
      list[0] = buff;
551
      list[0] = buff;
550
      list[1] = kittengets(0, 2, "Quit to DOS");
552
      list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
551
      list[2] = NULL;
553
      list[2] = NULL;
552
 
554
 
553
      choice = menuselect(++y, -1, 4, list, -1);
555
      choice = menuselect(++y, -1, 4, list, -1);
554
      if (choice < 0) return(MENUPREV);
556
      if (choice < 0) return(MENUPREV);
555
      if (choice == 1) return(MENUQUIT);
557
      if (choice == 1) return(MENUQUIT);
Line 558... Line 560...
558
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
560
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
559
      system(buff);
561
      system(buff);
560
      continue;
562
      continue;
561
    } else {
563
    } else {
562
      /* final confirmation */
564
      /* final confirmation */
-
 
565
      const char *list[3];
563
      char *list[] = { "Install SvarDOS", "Quit to DOS", NULL};
566
      list[0] = svarlang_strid(0x0001); /* Install SvarDOS */
564
      list[0] = kittengets(0, 1, list[0]);
567
      list[1] = svarlang_strid(0x0002); /* Quit to DOS */
565
      list[1] = kittengets(0, 2, list[1]);
568
      list[2] = NULL;
566
      snprintf(buff, sizeof(buff), kittengets(3, 6, "The installation of SvarDOS to %c: is about to begin."), cselecteddrive);
569
      snprintf(buff, sizeof(buff), svarlang_strid(0x0306), cselecteddrive); /* "The installation of SvarDOS to %c: is about to begin." */
567
      video_putstring(7, -1, COLOR_BODY[mono], buff, -1);
570
      video_putstring(7, -1, COLOR_BODY[mono], buff, -1);
568
      choice = menuselect(10, -1, 4, list, -1);
571
      choice = menuselect(10, -1, 4, list, -1);
569
      if (choice < 0) return(MENUPREV);
572
      if (choice < 0) return(MENUPREV);
570
      if (choice == 1) return(MENUQUIT);
573
      if (choice == 1) return(MENUQUIT);
571
      snprintf(buff, sizeof(buff), "SYS %c: %c: > NUL", sourcedrv, cselecteddrive);
574
      snprintf(buff, sizeof(buff), "SYS %c: %c: > NUL", sourcedrv, cselecteddrive);
Line 653... Line 656...
653
  fprintf(fd, "\r\n");
656
  fprintf(fd, "\r\n");
654
  fprintf(fd, "REM Uncomment the line below for automatic mouse support\r\n");
657
  fprintf(fd, "REM Uncomment the line below for automatic mouse support\r\n");
655
  fprintf(fd, "REM CTMOUSE\r\n");
658
  fprintf(fd, "REM CTMOUSE\r\n");
656
  fprintf(fd, "\r\n");
659
  fprintf(fd, "\r\n");
657
  fprintf(fd, "ECHO.\r\n");
660
  fprintf(fd, "ECHO.\r\n");
658
  fprintf(fd, "ECHO %s\r\n", kittengets(6, 0, "Welcome to SvarDOS! Type 'HELP' if you need help."));
661
  fprintf(fd, "ECHO %s\r\n", svarlang_strid(0x0600)); /* "Welcome to SvarDOS!" */
659
  fclose(fd);
662
  fclose(fd);
660
  /*** CREATE DIRECTORY FOR CONFIGURATION FILES ***/
663
  /*** CREATE DIRECTORY FOR CONFIGURATION FILES ***/
661
  snprintf(buff, sizeof(buff), "%c:\\SVARDOS", targetdrv);
664
  snprintf(buff, sizeof(buff), "%c:\\SVARDOS", targetdrv);
662
  mkdir(buff);
665
  mkdir(buff);
663
  snprintf(buff, sizeof(buff), "%c:\\SVARDOS\\CFG", targetdrv);
666
  snprintf(buff, sizeof(buff), "%c:\\SVARDOS\\CFG", targetdrv);
Line 747... Line 750...
747
  for (i = 0;; i++) {
750
  for (i = 0;; i++) {
748
    /* move forward to nearest entry or end of list */
751
    /* move forward to nearest entry or end of list */
749
    while (*pkgptr == 0) pkgptr++;
752
    while (*pkgptr == 0) pkgptr++;
750
    if (*pkgptr == 0xff) break;
753
    if (*pkgptr == 0xff) break;
751
    /* install the package */
754
    /* install the package */
752
    snprintf(buff, sizeof(buff), kittengets(4, 0, "Installing package %d/%d: %s"), i+1, pkglistlen, pkgptr);
755
    snprintf(buff, sizeof(buff), svarlang_strid(0x0400), i+1, pkglistlen, pkgptr); /* "Installing package %d/%d: %s" */
753
    strcat(buff, "       ");
756
    strcat(buff, "       ");
754
    video_putstringfix(10, 1, COLOR_BODY[mono], buff, sizeof(buff));
757
    video_putstringfix(10, 1, COLOR_BODY[mono], buff, sizeof(buff));
755
    /* wait for new diskette if package not found */
758
    /* wait for new diskette if package not found */
756
    snprintf(buff, sizeof(buff), "%c:\\%s.zip", srcdrv, pkgptr);
759
    snprintf(buff, sizeof(buff), "%c:\\%s.zip", srcdrv, pkgptr);
757
    while (fileexists(buff) != 0) {
760
    while (fileexists(buff) != 0) {
758
      putstringnls(12, 1, COLOR_BODY[mono], 4, 1, "*** INSERT THE DISK THAT CONTAINS THE REQUIRED FILE AND PRESS ANY KEY ***");
761
      putstringnls(12, 1, COLOR_BODY[mono], 4, 1); /* "INSERT THE DISK THAT CONTAINS THE REQUIRED FILE AND PRESS ANY KEY" */
759
      input_getkey();
762
      input_getkey();
760
      video_putstringfix(12, 1, COLOR_BODY[mono], "", 80); /* erase the 'insert disk' message */
763
      video_putstringfix(12, 1, COLOR_BODY[mono], "", 80); /* erase the 'insert disk' message */
761
    }
764
    }
762
    /* proceed with package copy (buff contains the src filename already) */
765
    /* proceed with package copy (buff contains the src filename already) */
763
    snprintf(buff + 32, sizeof(buff) - 32, "%c:\\temp\\%s.zip", targetdrv, pkgptr);
766
    snprintf(buff + 32, sizeof(buff) - 32, "%c:\\temp\\%s.zip", targetdrv, pkgptr);
Line 783... Line 786...
783
              "COPY AUTOEXEC.BAT C:\\\r\n"
786
              "COPY AUTOEXEC.BAT C:\\\r\n"
784
              "DEL AUTOEXEC.BAT\r\n");
787
              "DEL AUTOEXEC.BAT\r\n");
785
  /* print out the "installation over" message */
788
  /* print out the "installation over" message */
786
  fprintf(fd, "ECHO.\r\n"
789
  fprintf(fd, "ECHO.\r\n"
787
              "ECHO %s\r\n"
790
              "ECHO %s\r\n"
788
              "ECHO.\r\n", kittengets(5, 1, "SvarDOS installation is over. Please restart your computer now."));
791
              "ECHO.\r\n", svarlang_strid(0x0501)); /* "SvarDOS installation is over. Please restart your computer now" */
789
  fclose(fd);
792
  fclose(fd);
790
 
793
 
791
  /* prepare a dummy autoexec.bat that will call temp\postinst.bat */
794
  /* prepare a dummy autoexec.bat that will call temp\postinst.bat */
792
  snprintf(buff, sizeof(buff), "%c:\\autoexec.bat", targetdrv);
795
  snprintf(buff, sizeof(buff), "%c:\\autoexec.bat", targetdrv);
793
  fd = fopen(buff, "wb");
796
  fd = fopen(buff, "wb");
Line 805... Line 808...
805
 
808
 
806
 
809
 
807
static void finalreboot(void) {
810
static void finalreboot(void) {
808
  int y = 9;
811
  int y = 9;
809
  newscreen(2);
812
  newscreen(2);
810
  y += putstringnls(y, 1, COLOR_BODY[mono], 5, 0, "Your computer will reboot now.\nPlease remove the installation disk from your drive.");
813
  y += putstringnls(y, 1, COLOR_BODY[mono], 5, 0); /* "Your computer will reboot now.\nPlease remove the installation disk from your drive" */
811
  putstringnls(++y, 1, COLOR_BODY[mono], 0, 5, "Press any key...");
814
  putstringnls(++y, 1, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
812
  input_getkey();
815
  input_getkey();
813
  reboot();
816
  reboot();
814
}
817
}
815
 
818
 
816
 
819
 
Line 860... Line 863...
860
  sourcedrv = get_cur_drive() + 'A';
863
  sourcedrv = get_cur_drive() + 'A';
861
 
864
 
862
  /* init screen and detect mono status */
865
  /* init screen and detect mono status */
863
  mono = video_init();
866
  mono = video_init();
864
 
867
 
865
  kittenopen("INSTALL"); /* load initial NLS support */
-
 
866
 
-
 
867
 SelectLang:
868
 SelectLang:
868
  action = selectlang(&locales); /* welcome to svardos, select your language */
869
  action = selectlang(&locales); /* welcome to svardos, select your language */
869
  if (action != MENUNEXT) goto Quit;
870
  if (action != MENUNEXT) goto Quit;
870
  setenv("LANG", locales.lang, 1);
-
 
871
  loadcp(&locales);
871
  loadcp(&locales);
872
  kittenclose(); /* reload NLS with new language */
-
 
873
  kittenopen("INSTALL"); /* NLS support */
872
  svarlang_load("INSTALL", locales.lang, ".\\"); /* NLS support */
874
  action = selectkeyb(&locales);  /* what keyb layout should we use? */
873
  action = selectkeyb(&locales);  /* what keyb layout should we use? */
875
  if (action == MENUQUIT) goto Quit;
874
  if (action == MENUQUIT) goto Quit;
876
  if (action == MENUPREV) goto SelectLang;
875
  if (action == MENUPREV) goto SelectLang;
877
 
876
 
878
 WelcomeScreen:
877
 WelcomeScreen:
Line 887... Line 886...
887
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
886
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
888
  /*netcfg();*/ /* basic networking config */
887
  /*netcfg();*/ /* basic networking config */
889
  finalreboot(); /* remove the CD and reboot */
888
  finalreboot(); /* remove the CD and reboot */
890
 
889
 
891
 Quit:
890
 Quit:
892
  kittenclose(); /* close NLS support */
-
 
893
  video_clear(0x0700, 0, 0);
891
  video_clear(0x0700, 0, 0);
894
  video_movecursor(0, 0);
892
  video_movecursor(0, 0);
895
  return(0);
893
  return(0);
896
}
894
}