Subversion Repositories SvarDOS

Rev

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

Rev 1669 Rev 1671
Line 45... Line 45...
45
void int24hdl(void);
45
void int24hdl(void);
46
 
46
 
47
 
47
 
48
/* color scheme (preset for color) */
48
/* color scheme (preset for color) */
49
static unsigned char COLOR_TITLEBAR  = 0x70;
49
static unsigned char COLOR_TITLEBAR  = 0x70;
-
 
50
static unsigned char COLOR_TITLEVER  = 0x78;
50
static unsigned char COLOR_BODY      = 0x17;
51
static unsigned char COLOR_BODY      = 0x17;
51
static unsigned char COLOR_SELECT    = 0x70;
52
static unsigned char COLOR_SELECT    = 0x70;
52
static unsigned char COLOR_SELECTCUR = 0x1F;
53
static unsigned char COLOR_SELECTCUR = 0x1F;
53
 
54
 
-
 
55
/* build release string, populated at startup by reading floppy's label */
-
 
56
static char BUILDSTRING[13];
54
 
57
 
55
/* how much disk space does SvarDOS require (in MiB) */
58
/* how much disk space does SvarDOS require (in MiB) */
56
#define SVARDOS_DISK_REQ 8
59
#define SVARDOS_DISK_REQ 8
57
 
60
 
58
/* menu screens can output only one of these: */
61
/* menu screens can output only one of these: */
Line 267... Line 270...
267
  const char *msg;
270
  const char *msg;
268
  mdr_cout_cls(COLOR_BODY);
271
  mdr_cout_cls(COLOR_BODY);
269
  msg = svarlang_strid(0x00); /* "SVARDOS INSTALLATION" */
272
  msg = svarlang_strid(0x00); /* "SVARDOS INSTALLATION" */
270
  mdr_cout_char_rep(0, 0, ' ', COLOR_TITLEBAR, 80);
273
  mdr_cout_char_rep(0, 0, ' ', COLOR_TITLEBAR, 80);
271
  mdr_cout_str(0, 40 - (strlen(msg) >> 1), msg, COLOR_TITLEBAR, 80);
274
  mdr_cout_str(0, 40 - (strlen(msg) >> 1), msg, COLOR_TITLEBAR, 80);
-
 
275
  mdr_cout_str(0, 80 - strlen(BUILDSTRING), BUILDSTRING, COLOR_TITLEVER, 12);
-
 
276
 
272
  switch (statusbartype) {
277
  switch (statusbartype) {
273
    case 1:
278
    case 1:
274
      msg = svarlang_strid(0x000B); /* "Up/Down = Select entry | Enter = Validate your choice | ESC = Quit to DOS" */
279
      msg = svarlang_strid(0x000B); /* "Up/Down = Select entry | Enter = Validate your choice | ESC = Quit to DOS" */
275
      break;
280
      break;
276
    case 2:
281
    case 2:
Line 791... Line 796...
791
              "#gateway = 192.168.0.1\r\n");
796
              "#gateway = 192.168.0.1\r\n");
792
  fclose(fd);
797
  fclose(fd);
793
}
798
}
794
 
799
 
795
 
800
 
796
static int installpackages(char targetdrv, char srcdrv, const struct slocales *locales, const char *buildstring) {
801
static int installpackages(char targetdrv, char srcdrv, const struct slocales *locales) {
797
  char pkglist[512];
802
  char pkglist[512];
798
  int i, pkglistlen;
803
  int i, pkglistlen;
799
  size_t pkglistflen;
804
  size_t pkglistflen;
800
  char buff[1024]; /* must be *at least* 1 sector big for efficient file copying */
805
  char buff[1024]; /* must be *at least* 1 sector big for efficient file copying */
801
  FILE *fd = NULL;
806
  FILE *fd = NULL;
Line 837... Line 842...
837
 
842
 
838
  /* open the post-install autoexec.bat and prepare initial instructions */
843
  /* open the post-install autoexec.bat and prepare initial instructions */
839
  snprintf(buff, sizeof(buff), "%c:\\temp\\postinst.bat", targetdrv);
844
  snprintf(buff, sizeof(buff), "%c:\\temp\\postinst.bat", targetdrv);
840
  fd = fopen(buff, "wb");
845
  fd = fopen(buff, "wb");
841
  if (fd == NULL) return(-1);
846
  if (fd == NULL) return(-1);
842
  fprintf(fd, "@ECHO OFF\r\nECHO INSTALLING SVARDOS BUILD %s\r\n", buildstring);
847
  fprintf(fd, "@ECHO OFF\r\nECHO INSTALLING SVARDOS BUILD %s\r\n", BUILDSTRING);
843
 
848
 
844
  /* move COMMAND.COM so it does not clashes with the installation of the SVARCOM package */
849
  /* move COMMAND.COM so it does not clashes with the installation of the SVARCOM package */
845
  fprintf(fd, "COPY \\COMMAND.COM \\CMD.COM\r\n");
850
  fprintf(fd, "COPY \\COMMAND.COM \\CMD.COM\r\n");
846
  fprintf(fd, "SET COMSPEC=%c:\\CMD.COM\r\n", targetdrv);
851
  fprintf(fd, "SET COMSPEC=%c:\\CMD.COM\r\n", targetdrv);
847
  fprintf(fd, "DEL \\COMMAND.COM\r\n");
852
  fprintf(fd, "DEL \\COMMAND.COM\r\n");
Line 903... Line 908...
903
              "SET COMSPEC=C:\\COMMAND.COM\r\n"
908
              "SET COMSPEC=C:\\COMMAND.COM\r\n"
904
              "DEL \\CMD.COM\r\n");
909
              "DEL \\CMD.COM\r\n");
905
  /* print out the "installation over" message */
910
  /* print out the "installation over" message */
906
  fprintf(fd, "ECHO.\r\n"
911
  fprintf(fd, "ECHO.\r\n"
907
              "ECHO ");
912
              "ECHO ");
908
  fprintf(fd, svarlang_strid(0x0501), buildstring); /* "SvarDOS installation is over. Please restart your computer now" */
913
  fprintf(fd, svarlang_strid(0x0501), BUILDSTRING); /* "SvarDOS installation is over. Please restart your computer now" */
909
  fprintf(fd, "\r\n"
914
  fprintf(fd, "\r\n"
910
              "ECHO.\r\n");
915
              "ECHO.\r\n");
911
  fclose(fd);
916
  fclose(fd);
912
 
917
 
913
  /* prepare a dummy autoexec.bat that will call temp\postinst.bat */
918
  /* prepare a dummy autoexec.bat that will call temp\postinst.bat */
Line 971... Line 976...
971
  return(!fileexists(fname));
976
  return(!fileexists(fname));
972
}
977
}
973
#endif
978
#endif
974
 
979
 
975
 
980
 
976
int main(int argc, char **argv) {
981
int main(void) {
977
  struct slocales locales;
982
  struct slocales locales;
978
  int targetdrv;
983
  int targetdrv;
979
  int sourcedrv;
984
  int sourcedrv;
980
  int action;
985
  int action;
981
  const char *buildstring = "###";
-
 
982
 
986
 
983
  /* setup the internal int 24h handler ("always fail") */
987
  /* setup the internal int 24h handler ("always fail") */
984
  int24hdl();
988
  int24hdl();
985
 
989
 
-
 
990
  /* read the svardos build revision (from floppy label) */
-
 
991
  {
986
  if (argc != 1) buildstring = argv[1];
992
    const char *fspec = "*.*";
-
 
993
    const char *res = (void*)0x9E; /* default DTA is at PSP:80h, field 1Eh of DTA is the ASCIZ file name */
-
 
994
 
-
 
995
    _asm {
-
 
996
      push cx
-
 
997
      push dx
-
 
998
 
-
 
999
      mov ax, 0x4e00  /* findfirst */
-
 
1000
      mov cx, 0x08    /* file attr mask, 0x08 = volume label */
-
 
1001
      mov dx, fspec
-
 
1002
      int 0x21
-
 
1003
      jnc good
-
 
1004
      xor ah, ah
-
 
1005
      xchg bx, dx
-
 
1006
      mov [bx], ah
-
 
1007
      xchg bx, dx
-
 
1008
      good:
-
 
1009
 
-
 
1010
      pop dx
-
 
1011
      pop cx
-
 
1012
    }
-
 
1013
 
-
 
1014
    memcpy(BUILDSTRING, res, 12);
-
 
1015
  }
987
 
1016
 
988
  sourcedrv = get_cur_drive() + 'A';
1017
  sourcedrv = get_cur_drive() + 'A';
989
 
1018
 
990
  /* init screen and detect mono adapters */
1019
  /* init screen and detect mono adapters */
991
  if (mdr_cout_init(NULL, NULL) == 0) {
1020
  if (mdr_cout_init(NULL, NULL) == 0) {
992
    /* overload color scheme with mono settings */
1021
    /* overload color scheme with mono settings */
993
    COLOR_TITLEBAR = 0x70;
1022
    COLOR_TITLEBAR = 0x70;
-
 
1023
    COLOR_TITLEVER = 0x70;
994
    COLOR_BODY = 0x07;
1024
    COLOR_BODY = 0x07;
995
    COLOR_SELECT = 0x70;
1025
    COLOR_SELECT = 0x70;
996
    COLOR_SELECTCUR = 0x07;
1026
    COLOR_SELECTCUR = 0x07;
997
  }
1027
  }
998
 
1028
 
Line 1016... Line 1046...
1016
 
1046
 
1017
  targetdrv = preparedrive(sourcedrv); /* what drive should we install from? check avail. space */
1047
  targetdrv = preparedrive(sourcedrv); /* what drive should we install from? check avail. space */
1018
  if (targetdrv == MENUQUIT) goto Quit;
1048
  if (targetdrv == MENUQUIT) goto Quit;
1019
  if (targetdrv == MENUPREV) goto WelcomeScreen;
1049
  if (targetdrv == MENUPREV) goto WelcomeScreen;
1020
  bootfilesgen(targetdrv, &locales); /* generate boot files and other configurations */
1050
  bootfilesgen(targetdrv, &locales); /* generate boot files and other configurations */
1021
  if (installpackages(targetdrv, sourcedrv, &locales, buildstring) != 0) goto Quit;    /* install packages */
1051
  if (installpackages(targetdrv, sourcedrv, &locales) != 0) goto Quit;    /* install packages */
1022
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
1052
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
1023
  /*netcfg();*/ /* basic networking config */
1053
  /*netcfg();*/ /* basic networking config */
1024
  finalreboot(); /* remove the CD and reboot */
1054
  finalreboot(); /* remove the CD and reboot */
1025
 
1055
 
1026
 Quit:
1056
 Quit: