Subversion Repositories SvarDOS

Rev

Rev 1889 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1889 Rev 1892
Line 96... Line 96...
96
    return(ACTION_HELP);
96
    return(ACTION_HELP);
97
  }
97
  }
98
}
98
}
99
 
99
 
100
 
100
 
101
static int pkginst(const char *file, int flags, const char *dosdir, const struct customdirs *dirlist) {
101
static int pkginst(const char *file, int flags, const char *dosdir, const struct customdirs *dirlist, char bootdrive) {
102
  char pkgname[9];
102
  char pkgname[9];
103
  int res = 1;
103
  int res = 1;
104
  struct ziplist *zipfileidx;
104
  struct ziplist *zipfileidx;
105
  FILE *zipfilefd;
105
  FILE *zipfilefd;
106
 
106
 
107
  /* prepare the zip file for installation and fetch package's name */
107
  /* prepare the zip file for installation and fetch package's name */
108
  zipfileidx = pkginstall_preparepackage(pkgname, file, flags, &zipfilefd, dosdir, dirlist);
108
  zipfileidx = pkginstall_preparepackage(pkgname, file, flags, &zipfilefd, dosdir, dirlist, bootdrive);
109
  if (zipfileidx != NULL) {
109
  if (zipfileidx != NULL) {
110
 
110
 
111
    /* package name must be all lower-case for further file matching in the zip file */
111
    /* package name must be all lower-case for further file matching in the zip file */
112
    strlwr(pkgname);
112
    strlwr(pkgname);
113
 
113
 
114
    /* remove the old version of the package if we are UPDATING it */
114
    /* remove the old version of the package if we are UPDATING it */
115
    res = 0;
115
    res = 0;
116
    if (flags & PKGINST_UPDATE) res = pkgrem(pkgname, dosdir);
116
    if (flags & PKGINST_UPDATE) res = pkgrem(pkgname, dosdir);
117
 
117
 
118
    if (res == 0) res = pkginstall_installpackage(pkgname, dosdir, dirlist, zipfileidx, zipfilefd);
118
    if (res == 0) res = pkginstall_installpackage(pkgname, dosdir, dirlist, zipfileidx, zipfilefd, bootdrive);
119
    zip_freelist(&zipfileidx);
119
    zip_freelist(&zipfileidx);
120
  }
120
  }
121
 
121
 
122
  fclose(zipfilefd);
122
  fclose(zipfilefd);
123
  return(res);
123
  return(res);
Line 158... Line 158...
158
int main(int argc, char **argv) {
158
int main(int argc, char **argv) {
159
  int res = 1;
159
  int res = 1;
160
  enum ACTIONTYPES action;
160
  enum ACTIONTYPES action;
161
  const char *dosdir;
161
  const char *dosdir;
162
  struct customdirs *dirlist;
162
  struct customdirs *dirlist;
-
 
163
  char bootdrive;
163
 
164
 
164
  svarlang_autoload_exepath(argv[0], getenv("LANG"));   /* NLS init */
165
  svarlang_autoload_exepath(argv[0], getenv("LANG"));   /* NLS init */
165
 
166
 
166
  action = parsearg(argc, argv);
167
  action = parsearg(argc, argv);
167
  switch (action) {
168
  switch (action) {
Line 186... Line 187...
186
    puts(svarlang_str(2, 3)); /* "Example: SET DOSDIR=C:\SVARDOS" */
187
    puts(svarlang_str(2, 3)); /* "Example: SET DOSDIR=C:\SVARDOS" */
187
    goto GAMEOVER;
188
    goto GAMEOVER;
188
  }
189
  }
189
 
190
 
190
  /* load configuration */
191
  /* load configuration */
191
  if (loadconf(dosdir, &dirlist) != 0) goto GAMEOVER;
192
  if (loadconf(dosdir, &dirlist, &bootdrive) != 0) goto GAMEOVER;
192
 
193
 
193
  switch (action) {
194
  switch (action) {
194
    case ACTION_UPDATE:
195
    case ACTION_UPDATE:
195
    case ACTION_INSTALL:
196
    case ACTION_INSTALL:
196
      res = pkginst(argv[2], (action == ACTION_UPDATE)?PKGINST_UPDATE:0, dosdir, dirlist);
197
      res = pkginst(argv[2], (action == ACTION_UPDATE)?PKGINST_UPDATE:0, dosdir, dirlist, bootdrive);
197
      break;
198
      break;
198
    case ACTION_REMOVE:
199
    case ACTION_REMOVE:
199
      res = pkgrem(argv[2], dosdir);
200
      res = pkgrem(argv[2], dosdir);
200
      break;
201
      break;
201
    case ACTION_LISTFILES:
202
    case ACTION_LISTFILES: