Subversion Repositories SvarDOS

Rev

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

Rev 865 Rev 868
Line 21... Line 21...
21
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24
 * DEALINGS IN THE SOFTWARE.
24
 * DEALINGS IN THE SOFTWARE.
25
 *
25
 *
26
 * http://svardos.osdn.io
26
 * http://svardos.org
27
 */
27
 */
28
 
28
 
29
#include <dos.h>
29
#include <dos.h>
30
#include <direct.h>  /* mkdir() */
30
#include <direct.h>  /* mkdir() */
31
#include <stdio.h>   /* printf() and friends */
31
#include <stdio.h>   /* printf() and friends */
Line 697... Line 697...
697
              "#gateway = 192.168.0.1\r\n");
697
              "#gateway = 192.168.0.1\r\n");
698
  fclose(fd);
698
  fclose(fd);
699
}
699
}
700
 
700
 
701
 
701
 
702
static int installpackages(char targetdrv, char srcdrv, const struct slocales *locales) {
702
static int installpackages(char targetdrv, char srcdrv, const struct slocales *locales, const char *buildstring) {
703
  char pkglist[512];
703
  char pkglist[512];
704
  int i, pkglistlen;
704
  int i, pkglistlen;
705
  size_t pkglistflen;
705
  size_t pkglistflen;
706
  char buff[1024]; /* must be *at least* 1 sector big for efficient file copying */
706
  char buff[1024]; /* must be *at least* 1 sector big for efficient file copying */
707
  FILE *fd = NULL;
707
  FILE *fd = NULL;
Line 741... Line 741...
741
 
741
 
742
  /* open the post-install autoexec.bat and prepare initial instructions */
742
  /* open the post-install autoexec.bat and prepare initial instructions */
743
  snprintf(buff, sizeof(buff), "%c:\\temp\\postinst.bat", targetdrv);
743
  snprintf(buff, sizeof(buff), "%c:\\temp\\postinst.bat", targetdrv);
744
  fd = fopen(buff, "wb");
744
  fd = fopen(buff, "wb");
745
  if (fd == NULL) return(-1);
745
  if (fd == NULL) return(-1);
746
  fprintf(fd, "@ECHO OFF\r\n");
746
  fprintf(fd, "@ECHO OFF\r\nECHO INSTALLING SVARDOS BUILD %s\r\n", buildstring);
747
 
747
 
748
  /* copy packages */
748
  /* copy packages */
749
  pkgptr = pkglist;
749
  pkgptr = pkglist;
750
  for (i = 0;; i++) {
750
  for (i = 0;; i++) {
751
    /* move forward to nearest entry or end of list */
751
    /* move forward to nearest entry or end of list */
Line 785... Line 785...
785
              "DEL C:\\AUTOEXEC.BAT\r\n"
785
              "DEL C:\\AUTOEXEC.BAT\r\n"
786
              "COPY AUTOEXEC.BAT C:\\\r\n"
786
              "COPY AUTOEXEC.BAT C:\\\r\n"
787
              "DEL AUTOEXEC.BAT\r\n");
787
              "DEL AUTOEXEC.BAT\r\n");
788
  /* print out the "installation over" message */
788
  /* print out the "installation over" message */
789
  fprintf(fd, "ECHO.\r\n"
789
  fprintf(fd, "ECHO.\r\n"
790
              "ECHO %s\r\n"
790
              "ECHO ");
791
              "ECHO.\r\n", svarlang_strid(0x0501)); /* "SvarDOS installation is over. Please restart your computer now" */
791
  fprintf(fd, svarlang_strid(0x0501), buildstring); /* "SvarDOS installation is over. Please restart your computer now" */
-
 
792
  fprintf(fd, "\r\n"
-
 
793
              "ECHO.\r\n");
792
  fclose(fd);
794
  fclose(fd);
793
 
795
 
794
  /* prepare a dummy autoexec.bat that will call temp\postinst.bat */
796
  /* prepare a dummy autoexec.bat that will call temp\postinst.bat */
795
  snprintf(buff, sizeof(buff), "%c:\\autoexec.bat", targetdrv);
797
  snprintf(buff, sizeof(buff), "%c:\\autoexec.bat", targetdrv);
796
  fd = fopen(buff, "wb");
798
  fd = fopen(buff, "wb");
Line 852... Line 854...
852
  return(fileexists(fname));
854
  return(fileexists(fname));
853
}
855
}
854
#endif
856
#endif
855
 
857
 
856
 
858
 
857
int main(void) {
859
int main(int argc, char **argv) {
858
  struct slocales locales;
860
  struct slocales locales;
859
  int targetdrv;
861
  int targetdrv;
860
  int sourcedrv;
862
  int sourcedrv;
861
  int action;
863
  int action;
-
 
864
  const char *buildstring = "###";
-
 
865
 
-
 
866
  if (argc != 1) buildstring = argv[1];
862
 
867
 
863
  sourcedrv = get_cur_drive() + 'A';
868
  sourcedrv = get_cur_drive() + 'A';
864
 
869
 
865
  /* init screen and detect mono status */
870
  /* init screen and detect mono status */
866
  mono = video_init();
871
  mono = video_init();
Line 885... Line 890...
885
  }
890
  }
886
  targetdrv = preparedrive(sourcedrv); /* what drive should we install from? check avail. space */
891
  targetdrv = preparedrive(sourcedrv); /* what drive should we install from? check avail. space */
887
  if (targetdrv == MENUQUIT) goto Quit;
892
  if (targetdrv == MENUQUIT) goto Quit;
888
  if (targetdrv == MENUPREV) goto WelcomeScreen;
893
  if (targetdrv == MENUPREV) goto WelcomeScreen;
889
  bootfilesgen(targetdrv, &locales); /* generate boot files and other configurations */
894
  bootfilesgen(targetdrv, &locales); /* generate boot files and other configurations */
890
  if (installpackages(targetdrv, sourcedrv, &locales) != 0) goto Quit;    /* install packages */
895
  if (installpackages(targetdrv, sourcedrv, &locales, buildstring) != 0) goto Quit;    /* install packages */
891
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
896
  /*localcfg();*/ /* show local params (currency, etc), and propose to change them (based on localcfg) */
892
  /*netcfg();*/ /* basic networking config */
897
  /*netcfg();*/ /* basic networking config */
893
  finalreboot(); /* remove the CD and reboot */
898
  finalreboot(); /* remove the CD and reboot */
894
 
899
 
895
 Quit:
900
 Quit: