Subversion Repositories SvarDOS

Rev

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

Rev 1940 Rev 1942
Line 521... Line 521...
521
  return((int)res);
521
  return((int)res);
522
}
522
}
523
 
523
 
524
 
524
 
525
/* returns 0 if disk is empty, non-zero otherwise */
525
/* returns 0 if disk is empty, non-zero otherwise */
526
static int diskempty(int drv) {
526
static int diskempty(char drv) {
527
  unsigned int rc;
527
  unsigned int rc;
528
  int res;
528
  int res;
529
  char buff[8];
529
  char buff[8];
530
  struct find_t fileinfo;
530
  struct find_t fileinfo;
531
  snprintf(buff, sizeof(buff), "%c:\\*.*", 'A' + drv - 1);
531
  snprintf(buff, sizeof(buff), "%c:\\*.*", drv);
532
  rc = _dos_findfirst(buff, _A_NORMAL | _A_SUBDIR | _A_HIDDEN | _A_SYSTEM, &fileinfo);
532
  rc = _dos_findfirst(buff, _A_NORMAL | _A_SUBDIR | _A_HIDDEN | _A_SYSTEM, &fileinfo);
533
  if (rc == 0) {
533
  if (rc == 0) {
534
    res = 1; /* call successfull means disk is not empty */
534
    res = 1; /* call successfull means disk is not empty */
535
  } else {
535
  } else {
536
    res = 0;
536
    res = 0;
Line 745... Line 745...
745
 
745
 
746
  return(0);
746
  return(0);
747
}
747
}
748
 
748
 
749
 
749
 
750
static int preparedrive(void) {
750
/* displays a list of drives and asks user to choose one for installation
751
  int selecteddrive;
751
 * returns a word with DOS drive value in lowest 8 bits (A=1, B=2, etc) and
752
  char cselecteddrive;
752
 * the BIOS drive id in highest 8 bits (1, 2...) */
753
  int choice;
753
static int selectdrive(void) {
754
  char buff[512];
754
  char buff[512];
755
  int driveid = 1; /* fdisk runs on first drive (unless USB boot) */
-
 
756
  struct drivelist drives[4];
755
  struct drivelist drives[4];
-
 
756
  char drvlist[4][32]; /* C: [2048 MB] */
-
 
757
  int i, drvlistlen = 0;
-
 
758
  const char *menulist[16];
-
 
759
  unsigned char driveid = 1; /* fdisk runs on first drive (unless USB boot) */
757
 
760
 
758
  /* read MBR of first HDD */
761
  /* read MBR of first HDD */
759
  {
-
 
760
    int i;
-
 
761
    i = get_drives_list(buff, drives);
762
  i = get_drives_list(buff, drives);
762
    if (i) {
763
  if (i) {
763
      printf("get_drives_list() error = %d", i);
764
    printf("get_drives_list() error = %d", i);
764
    }
-
 
-
 
765
    /* TODO build a proper menu with an explanation about drive not partitioned */
765
  }
766
  }
766
 
767
 
767
  for (;;) {
-
 
768
    char drvlist[4][40]; /* C: [2048 MB] */
-
 
769
    int i, drvlistlen = 0;
-
 
770
 
-
 
771
    /* build a menu with all drives */
768
  /* build a menu with all drives */
772
    for (i = 0; i < 4; i++) {
769
  for (i = 0; i < 4; i++) {
773
      if (drives[i].hd == 0) continue;
770
    if (drives[i].hd == 0) continue;
774
      snprintf(drvlist[drvlistlen], sizeof(drvlist[0]), "%c: [%u MiB, hd%c%u, act=%u]", '@' + drives[i].dosid, drives[i].tot_size, 'a' + (drives[i].hd & 127), i, drives[i].active);
771
    snprintf(drvlist[drvlistlen], sizeof(drvlist[0]), "%c: [%u MiB, hd%c%u, act=%u]", '@' + drives[i].dosid, drives[i].tot_size, 'a' + (drives[i].hd & 127), i, drives[i].active);
775
      drvlistlen++;
772
    drvlistlen++;
776
    }
773
  }
777
 
774
 
778
    /* if no drive found - disk not partitioned? */
775
  /* if no drive found - disk not partitioned? */
779
    if (drvlistlen == 0) {
776
  if (drvlistlen == 0) {
780
      const char *list[4];
777
    const char *list[4];
781
      newscreen(0);
778
    newscreen(0);
782
      list[0] = svarlang_str(0, 3); /* Create a partition automatically */
779
    list[0] = svarlang_str(0, 3); /* Create a partition automatically */
783
      list[1] = svarlang_str(0, 4); /* Run the FDISK tool */
780
    list[1] = svarlang_str(0, 4); /* Run the FDISK tool */
784
      list[2] = svarlang_str(0, 2); /* Quit to DOS */
781
    list[2] = svarlang_str(0, 2); /* Quit to DOS */
785
      list[3] = NULL;
782
    list[3] = NULL;
786
      snprintf(buff, sizeof(buff), svarlang_strid(0x0300), SVARDOS_DISK_REQ); /* "ERROR: No drive could be found. Note, that SvarDOS requires at least %d MiB of available disk space */
783
    snprintf(buff, sizeof(buff), svarlang_strid(0x0300), SVARDOS_DISK_REQ); /* "ERROR: No drive could be found. Note, that SvarDOS requires at least %d MiB of available disk space */
787
      switch (menuselect(6 + putstringwrap(4, 1, COLOR_BODY, buff), 3, list, -1)) {
784
    switch (menuselect(6 + putstringwrap(4, 1, COLOR_BODY, buff), 3, list, -1)) {
788
        case 0:
785
      case 0:
789
          sprintf(buff, "FDISK /PRI:MAX %d", driveid);
786
        sprintf(buff, "FDISK /PRI:MAX %u", driveid);
790
          exec(buff);
787
        exec(buff);
791
          break;
788
        break;
792
        case 1:
789
      case 1:
793
          mdr_cout_cls(0x07);
790
        mdr_cout_cls(0x07);
794
          mdr_cout_locate(0, 0);
791
        mdr_cout_locate(0, 0);
795
          sprintf(buff, "FDISK %d", driveid);
792
        sprintf(buff, "FDISK %u", driveid);
796
          exec(buff);
793
        exec(buff);
797
          break;
794
        break;
798
        case 2:
795
      case 2:
799
          return(MENUQUIT);
796
        return(MENUQUIT);
800
        default:
797
      default:
801
          return(-1);
798
        return(-1);
802
      }
-
 
803
      /* write a temporary MBR which only skips the drive (in case BIOS would
-
 
804
       * try to boot off the not-yet-ready C: disk) */
-
 
805
      sprintf(buff, "FDISK /LOADIPL %d", driveid);
-
 
806
      exec(buff); /* writes BOOT.MBR into actual MBR */
-
 
807
      newscreen(2);
-
 
808
      putstringnls(10, 10, COLOR_BODY, 3, 1); /* "Your computer will reboot now." */
-
 
809
      putstringnls(12, 10, COLOR_BODY, 0, 5); /* "Press any key..." */
-
 
810
      mdr_dos_getkey();
-
 
811
      reboot();
-
 
812
      return(MENUQUIT);
-
 
813
    }
799
    }
-
 
800
    /* write a temporary MBR which only skips the drive (in case BIOS would
-
 
801
     * try to boot off the not-yet-ready C: disk) */
-
 
802
    sprintf(buff, "FDISK /LOADIPL %u", driveid);
-
 
803
    exec(buff); /* writes BOOT.MBR into actual MBR */
-
 
804
    newscreen(2);
-
 
805
    putstringnls(10, 10, COLOR_BODY, 3, 1); /* "Your computer will reboot now." */
-
 
806
    putstringnls(12, 10, COLOR_BODY, 0, 5); /* "Press any key..." */
-
 
807
    mdr_dos_getkey();
-
 
808
    reboot();
-
 
809
    return(MENUQUIT);
-
 
810
  }
814
 
811
 
815
    /* select the drive from list */
812
  /* select the drive from list */
816
    {
-
 
817
      const char *list[16];
-
 
818
      int i;
-
 
819
      for (i = 0; i < drvlistlen; i++) list[i] = drvlist[i];
813
  for (i = 0; i < drvlistlen; i++) menulist[i] = drvlist[i];
820
      list[i++] = svarlang_str(0, 2); /* Quit to DOS */
814
  menulist[i++] = svarlang_str(0, 2); /* Quit to DOS */
821
      list[i] = NULL;
815
  menulist[i] = NULL;
822
      newscreen(0);
816
  newscreen(0);
823
 
-
 
824
      i = menuselect(6 /*ypos*/, i /*height*/, list, -1);
-
 
825
      if (i < 0) {
-
 
826
        return(MENUPREV);
-
 
827
      } else if (i < drvlistlen) {
-
 
828
        selecteddrive = list[i][0] - '@';
-
 
829
      } else {
-
 
830
        return(MENUQUIT);
-
 
831
      }
-
 
832
 
817
 
-
 
818
  i = menuselect(6 /*ypos*/, i /*height*/, menulist, -1);
-
 
819
  if (i < 0) {
-
 
820
    return(MENUPREV);
-
 
821
  } else if (i < drvlistlen) {
833
      cselecteddrive = '@' + selecteddrive;
822
    return((driveid << 8) | (menulist[i][0] - '@'));
834
    }
823
  }
835
 
824
 
836
    /* if not formatted, propose to format it right away (try to create a directory) */
-
 
837
    if (test_drive_write(cselecteddrive) != 0) {
-
 
838
      const char *list[3];
-
 
839
      newscreen(0);
825
  return(MENUQUIT);
840
      snprintf(buff, sizeof(buff), svarlang_str(3, 3), cselecteddrive); /* "ERROR: Drive %c: seems to be unformated. Do you wish to format it?") */
-
 
841
      mdr_cout_str(7, 1, buff, COLOR_BODY, 80);
-
 
842
 
-
 
843
      snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
-
 
844
      list[0] = buff;
-
 
845
      list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
-
 
846
      list[2] = NULL;
-
 
847
 
826
}
848
      choice = menuselect(12, 2, list, -1);
-
 
849
      if (choice < 0) return(MENUPREV);
-
 
850
      if (choice == 1) return(MENUQUIT);
-
 
851
      mdr_cout_cls(0x07);
-
 
852
      mdr_cout_locate(0, 0);
-
 
853
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
-
 
854
      exec(buff);
-
 
855
      continue;
-
 
856
    }
-
 
857
 
827
 
858
    /* check total disk space */
-
 
859
    {
-
 
860
      int ds = disksize(selecteddrive);
-
 
861
      if (ds < SVARDOS_DISK_REQ) {
-
 
862
        int y = 9;
-
 
863
        newscreen(2);
-
 
864
        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." */
-
 
865
        y += putstringwrap(y, 1, COLOR_BODY, buff);
-
 
866
        putstringnls(++y, 1, COLOR_BODY, 0, 5); /* "Press any key..." */
-
 
867
        mdr_dos_getkey();
-
 
868
        return(MENUQUIT);
-
 
869
      }
-
 
870
    }
-
 
871
 
828
 
-
 
829
static int preparedrive(int hd_drv) {
-
 
830
  unsigned char selecteddrive;
-
 
831
  unsigned char driveid;
-
 
832
  char cselecteddrive;
-
 
833
  int choice;
-
 
834
  char buff[512];
-
 
835
 
-
 
836
  /* decode hd and drive id from hd_drv */
-
 
837
  selecteddrive = hd_drv & 0xff;
-
 
838
  driveid = hd_drv >> 8;
-
 
839
 
-
 
840
  cselecteddrive = '@' + selecteddrive;
-
 
841
 
-
 
842
  TRY_AGAIN:
-
 
843
 
-
 
844
  /* if not formatted, propose to format it right away (try to create a directory) */
-
 
845
  if (test_drive_write(cselecteddrive) != 0) {
872
    /* is the disk empty? */
846
    const char *list[3];
873
    newscreen(0);
847
    newscreen(0);
-
 
848
    snprintf(buff, sizeof(buff), svarlang_str(3, 3), cselecteddrive); /* "ERROR: Drive %c: seems to be unformated. Do you wish to format it?") */
-
 
849
    mdr_cout_str(7, 1, buff, COLOR_BODY, 80);
-
 
850
 
-
 
851
    snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
-
 
852
    list[0] = buff;
-
 
853
    list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
-
 
854
    list[2] = NULL;
-
 
855
 
-
 
856
    choice = menuselect(12, 2, list, -1);
-
 
857
    if (choice < 0) return(MENUPREV);
-
 
858
    if (choice == 1) return(MENUQUIT);
-
 
859
    mdr_cout_cls(0x07);
-
 
860
    mdr_cout_locate(0, 0);
-
 
861
    snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
-
 
862
    exec(buff);
-
 
863
    goto TRY_AGAIN;
-
 
864
  }
-
 
865
 
-
 
866
  /* check total disk space */
-
 
867
  if (disksize(selecteddrive) < SVARDOS_DISK_REQ) {
-
 
868
    int y = 9;
-
 
869
    newscreen(2);
-
 
870
    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." */
-
 
871
    y += putstringwrap(y, 1, COLOR_BODY, buff);
-
 
872
    putstringnls(++y, 1, COLOR_BODY, 0, 5); /* "Press any key..." */
-
 
873
    mdr_dos_getkey();
-
 
874
    return(MENUPREV);
-
 
875
  }
-
 
876
 
-
 
877
  /* is the disk empty? */
-
 
878
  newscreen(0);
874
    if (diskempty(selecteddrive) != 0) {
879
  if (diskempty(cselecteddrive) != 0) {
875
      const char *list[3];
880
    const char *list[3];
876
      int y = 6;
881
    int y = 6;
877
      snprintf(buff, sizeof(buff), svarlang_strid(0x0305), cselecteddrive); /* "ERROR: Drive %c: not empty" */
882
    snprintf(buff, sizeof(buff), svarlang_strid(0x0305), cselecteddrive); /* "ERROR: Drive %c: not empty" */
878
      y += putstringwrap(y, 1, COLOR_BODY, buff);
883
    y += putstringwrap(y, 1, COLOR_BODY, buff);
879
 
884
 
880
      snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
885
    snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
881
      list[0] = buff;
886
    list[0] = buff;
882
      list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
887
    list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
883
      list[2] = NULL;
888
    list[2] = NULL;
884
 
889
 
885
      choice = menuselect(++y, 2, list, -1);
890
    choice = menuselect(++y, 2, list, -1);
886
      if (choice < 0) return(MENUPREV);
891
    if (choice < 0) return(MENUPREV);
887
      if (choice == 1) return(MENUQUIT);
892
    if (choice == 1) return(MENUQUIT);
888
      mdr_cout_cls(0x07);
893
    mdr_cout_cls(0x07);
889
      mdr_cout_locate(0, 0);
894
    mdr_cout_locate(0, 0);
890
      snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
895
    snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
891
      exec(buff);
896
    exec(buff);
892
      continue;
897
    goto TRY_AGAIN;
893
    } else {
898
  } else {
894
      /* final confirmation */
899
    /* final confirmation */
895
      const char *list[3];
900
    const char *list[3];
896
      list[0] = svarlang_strid(0x0001); /* Install SvarDOS */
901
    list[0] = svarlang_strid(0x0001); /* Install SvarDOS */
897
      list[1] = svarlang_strid(0x0002); /* Quit to DOS */
902
    list[1] = svarlang_strid(0x0002); /* Quit to DOS */
898
      list[2] = NULL;
903
    list[2] = NULL;
899
      snprintf(buff, sizeof(buff), svarlang_strid(0x0306), cselecteddrive); /* "The installation of SvarDOS to %c: is about to begin." */
904
    snprintf(buff, sizeof(buff), svarlang_strid(0x0306), cselecteddrive); /* "The installation of SvarDOS to %c: is about to begin." */
900
      mdr_cout_str(7, 40 - (strlen(buff) / 2), buff, COLOR_BODY, 80);
905
    mdr_cout_str(7, 40 - (strlen(buff) / 2), buff, COLOR_BODY, 80);
901
      choice = menuselect(10, 2, list, -1);
906
    choice = menuselect(10, 2, list, -1);
902
      if (choice < 0) return(MENUPREV);
907
    if (choice < 0) return(MENUPREV);
903
      if (choice == 1) return(MENUQUIT);
908
    if (choice == 1) return(MENUQUIT);
904
      snprintf(buff, sizeof(buff), "SYS %c: > NUL", cselecteddrive);
909
    snprintf(buff, sizeof(buff), "SYS %c: > NUL", cselecteddrive);
905
      exec(buff);
910
    exec(buff);
906
      sprintf(buff, "FDISK /MBR %d", driveid);
911
    sprintf(buff, "FDISK /MBR %d", driveid);
907
      exec(buff);
912
    exec(buff);
908
      snprintf(buff, sizeof(buff), "%c:\\TEMP", cselecteddrive);
913
    snprintf(buff, sizeof(buff), "%c:\\SVARDOS", cselecteddrive);
909
      mkdir(buff);
914
    mkdir(buff);
-
 
915
    snprintf(buff + 3, sizeof(buff), "TEMP");
910
      return(cselecteddrive);
916
    mkdir(buff);
911
    }
917
    return(0);
912
  }
918
  }
913
}
919
}
914
 
920
 
915
 
921
 
916
/* generates locales-related configurations and writes them to file (this
922
/* generates locales-related configurations and writes them to file (this
Line 1078... Line 1084...
1078
              "#gateway = 192.168.0.1\r\n");
1084
              "#gateway = 192.168.0.1\r\n");
1079
  fclose(fd);
1085
  fclose(fd);
1080
}
1086
}
1081
 
1087
 
1082
 
1088
 
1083
static int copypackages(char targetdrv, const struct slocales *locales) {
1089
static int copypackages(char drvletter, const struct slocales *locales) {
1084
  char pkglist[512];
1090
  char pkglist[512];
1085
  int i, pkglistlen;
1091
  int i, pkglistlen;
1086
  size_t pkglistflen;
1092
  size_t pkglistflen;
1087
  char buff[1024]; /* must be *at least* 1 sector big for efficient file copying */
1093
  char buff[1024]; /* must be *at least* 1 sector big for efficient file copying */
1088
  FILE *fd = NULL;
1094
  FILE *fd = NULL;
1089
  char *pkgptr;
1095
  char *pkgptr;
-
 
1096
 
1090
  newscreen(3);
1097
  newscreen(3);
-
 
1098
 
1091
  /* load pkg list */
1099
  /* load pkg list */
1092
  fd = fopen("install.lst", "rb");
1100
  fd = fopen("install.lst", "rb");
1093
  if (fd == NULL) {
1101
  if (fd == NULL) {
1094
    mdr_cout_str(10, 30, "ERROR: INSTALL.LST NOT FOUND", COLOR_BODY, 80);
1102
    mdr_cout_str(10, 30, "ERROR: INSTALL.LST NOT FOUND", COLOR_BODY, 80);
1095
    mdr_dos_getkey();
1103
    mdr_dos_getkey();
Line 1117... Line 1125...
1117
        break;
1125
        break;
1118
    }
1126
    }
1119
  }
1127
  }
1120
 
1128
 
1121
  /* copy pkg.exe, install.com and install.lng to the new drive, along with all packages */
1129
  /* copy pkg.exe, install.com and install.lng to the new drive, along with all packages */
1122
  snprintf(buff, sizeof(buff), "%c:\\TEMP\\PKG.EXE", targetdrv);
1130
  snprintf(buff, sizeof(buff), "%c:\\TEMP\\PKG.EXE", drvletter);
1123
  fcopy(buff, buff + 8, buff, sizeof(buff));
1131
  fcopy(buff, buff + 8, buff, sizeof(buff));
1124
  snprintf(buff, sizeof(buff), "%c:\\TEMP\\INSTALL.COM", targetdrv);
1132
  snprintf(buff, sizeof(buff), "%c:\\TEMP\\INSTALL.COM", drvletter);
1125
  fcopy(buff, buff + 8, buff, sizeof(buff));
1133
  fcopy(buff, buff + 8, buff, sizeof(buff));
1126
  snprintf(buff, sizeof(buff), "%c:\\TEMP\\INSTALL.LNG", targetdrv);
1134
  snprintf(buff, sizeof(buff), "%c:\\TEMP\\INSTALL.LNG", drvletter);
1127
  fcopy(buff, buff + 8, buff, sizeof(buff));
1135
  fcopy(buff, buff + 8, buff, sizeof(buff));
1128
 
1136
 
1129
  /* copy packages */
1137
  /* copy packages */
1130
  for (i = 0;; i++) {
1138
  for (i = 0;; i++) {
1131
    RETRY_ENTIRE_LIST:
1139
    RETRY_ENTIRE_LIST:
Line 1154... Line 1162...
1154
    snprintf(buff, sizeof(buff), svarlang_strid(0x0400), i+1, pkglistlen, pkgptr); /* "Installing package %d/%d: %s" */
1162
    snprintf(buff, sizeof(buff), svarlang_strid(0x0400), i+1, pkglistlen, pkgptr); /* "Installing package %d/%d: %s" */
1155
    strcat(buff, "       ");
1163
    strcat(buff, "       ");
1156
    mdr_cout_str(10, 1, buff, COLOR_BODY, 40);
1164
    mdr_cout_str(10, 1, buff, COLOR_BODY, 40);
1157
 
1165
 
1158
    /* proceed with package copy */
1166
    /* proceed with package copy */
1159
    sprintf(buff, "%c:\\TEMP\\%s.svp", targetdrv, pkgptr);
1167
    sprintf(buff, "%c:\\TEMP\\%s.svp", drvletter, pkgptr);
1160
    if (fcopy(buff, buff + 8, buff, sizeof(buff)) != 0) {
1168
    if (fcopy(buff, buff + 8, buff, sizeof(buff)) != 0) {
1161
      mdr_cout_str(10, 30, "READ ERROR", COLOR_BODY, 80);
1169
      mdr_cout_str(10, 30, "READ ERROR", COLOR_BODY, 80);
1162
      mdr_dos_getkey();
1170
      mdr_dos_getkey();
1163
      return(-1);
1171
      return(-1);
1164
    }
1172
    }
Line 1168... Line 1176...
1168
      pkgptr++;
1176
      pkgptr++;
1169
    }
1177
    }
1170
  }
1178
  }
1171
 
1179
 
1172
  /* open the post-install autoexec.bat and prepare initial instructions */
1180
  /* open the post-install autoexec.bat and prepare initial instructions */
1173
  snprintf(buff, sizeof(buff), "%c:\\TEMP\\POSTINST.BAT", targetdrv);
1181
  snprintf(buff, sizeof(buff), "%c:\\TEMP\\POSTINST.BAT", drvletter);
1174
  fd = fopen(buff, "wb");
1182
  fd = fopen(buff, "wb");
1175
  if (fd == NULL) return(-1);
1183
  if (fd == NULL) return(-1);
1176
  fputs(
1184
  fputs(
1177
    "@ECHO OFF\r\n"
1185
    "@ECHO OFF\r\n"
1178
    "INSTALL\r\n"  /* installer will run in 2nd stage (generating pkg.cfg and stuff) */
1186
    "INSTALL\r\n"  /* installer will run in 2nd stage (generating pkg.cfg and stuff) */
Line 1202... Line 1210...
1202
  fprintf(fd, "\r\n"
1210
  fprintf(fd, "\r\n"
1203
              "ECHO.\r\n");
1211
              "ECHO.\r\n");
1204
  fclose(fd);
1212
  fclose(fd);
1205
 
1213
 
1206
  /* prepare a dummy autoexec.bat that will call temp\postinst.bat */
1214
  /* prepare a dummy autoexec.bat that will call temp\postinst.bat */
1207
  snprintf(buff, sizeof(buff), "%c:\\autoexec.bat", targetdrv);
1215
  snprintf(buff, sizeof(buff), "%c:\\autoexec.bat", drvletter);
1208
  fd = fopen(buff, "wb");
1216
  fd = fopen(buff, "wb");
1209
  if (fd == NULL) return(-1);
1217
  if (fd == NULL) return(-1);
1210
  fprintf(fd, "@ECHO OFF\r\n"
1218
  fprintf(fd, "@ECHO OFF\r\n"
1211
              "SET DOSDIR=\\SVARDOS\r\n"
1219
              "SET DOSDIR=\\SVARDOS\r\n"
1212
              "PATH %%DOSDIR%%\r\n");
1220
              "PATH %%DOSDIR%%\r\n");
Line 1326... Line 1334...
1326
  if (action == MENUPREV) {
1334
  if (action == MENUPREV) {
1327
    if (locales == NULL) goto QUIT;
1335
    if (locales == NULL) goto QUIT;
1328
    goto SelectLang;
1336
    goto SelectLang;
1329
  }
1337
  }
1330
 
1338
 
-
 
1339
 SelDriveScreen:
1331
  targetdrv = preparedrive(); /* what drive should we install to? check avail. space */
1340
  targetdrv = selectdrive();
1332
  if (targetdrv == MENUQUIT) goto QUIT;
1341
  if (targetdrv == MENUQUIT) goto QUIT;
1333
  if (targetdrv == MENUPREV) goto WelcomeScreen;
1342
  if (targetdrv == MENUPREV) goto WelcomeScreen;
-
 
1343
 
-
 
1344
  action = preparedrive(targetdrv); /* what drive should we install to? check avail. space */
-
 
1345
  if (action == MENUQUIT) goto QUIT;
-
 
1346
  if (action == MENUPREV) goto SelDriveScreen;
-
 
1347
  targetdrv = (targetdrv & 0xff) + '@'; /* convert the hd+drv into a DOS letter */
-
 
1348
 
-
 
1349
  /* copy packages to dst drive */
1334
  if (copypackages(targetdrv, locales) != 0) goto QUIT;    /* copy packages to dst drive */
1350
  if (copypackages(targetdrv, locales) != 0) goto QUIT;
1335
  finalreboot(); /* remove the install medium and reboot */
1351
  finalreboot(); /* remove the install medium and reboot */
1336
 
1352
 
1337
  goto QUIT;
1353
  goto QUIT;
1338
 
1354
 
1339
 GENCONF: /* second stage of the installation (run from the destination disk) */
1355
 GENCONF: /* second stage of the installation (run from the destination disk) */