Subversion Repositories SvarDOS

Rev

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

Rev 221 Rev 225
Line 83... Line 83...
83
  /* return the result */
83
  /* return the result */
84
  return(res);
84
  return(res);
85
}
85
}
86
 
86
 
87
 
87
 
88
static int pkginst(char *file, int flags, char *dosdir, char *tempdir, struct customdirs *dirlist, char *mapdrv) {
88
static int pkginst(char *file, int flags, char *dosdir, char *tempdir, struct customdirs *dirlist) {
89
  char pkgname[32];
89
  char pkgname[32];
90
  int t, lastpathdelim = -1, u = 0;
90
  int t, lastpathdelim = -1, u = 0;
91
  char *buffmem1k;
91
  char *buffmem1k;
92
  struct ziplist *zipfileidx;
92
  struct ziplist *zipfileidx;
93
  FILE *zipfilefd;
93
  FILE *zipfilefd;
Line 109... Line 109...
109
  if (buffmem1k == NULL) {
109
  if (buffmem1k == NULL) {
110
    puts("ERROR: Out of memory");
110
    puts("ERROR: Out of memory");
111
    return(1);
111
    return(1);
112
  }
112
  }
113
  /* prepare the zip file and install it */
113
  /* prepare the zip file and install it */
114
  zipfileidx = pkginstall_preparepackage(NULL, pkgname, tempdir, file, flags, NULL, &zipfilefd, NULL, 0, NULL, dosdir, dirlist, buffmem1k, mapdrv);
114
  zipfileidx = pkginstall_preparepackage(pkgname, file, flags, &zipfilefd, dosdir, dirlist, buffmem1k);
115
  free(buffmem1k);
115
  free(buffmem1k);
116
  if (zipfileidx != NULL) {
116
  if (zipfileidx != NULL) {
117
    int res = 0;
117
    int res = 0;
118
    if (pkginstall_installpackage(pkgname, dosdir, dirlist, zipfileidx, zipfilefd, mapdrv) != 0) res = 1;
118
    if (pkginstall_installpackage(pkgname, dosdir, dirlist, zipfileidx, zipfilefd) != 0) res = 1;
119
    fclose(zipfilefd);
119
    fclose(zipfilefd);
120
    return(res);
120
    return(res);
121
  } else {
121
  } else {
122
    fclose(zipfilefd);
122
    fclose(zipfilefd);
123
    return(1);
123
    return(1);
Line 128... Line 128...
128
int main(int argc, char **argv) {
128
int main(int argc, char **argv) {
129
  int res, flags;
129
  int res, flags;
130
  enum ACTIONTYPES action;
130
  enum ACTIONTYPES action;
131
  char *dosdir, *tempdir, *cfgfile;
131
  char *dosdir, *tempdir, *cfgfile;
132
  struct customdirs *dirlist;
132
  struct customdirs *dirlist;
133
  char *mapdrv = "";
-
 
134
 
133
 
135
  action = parsearg(argc, argv);
134
  action = parsearg(argc, argv);
136
  if (action == ACTION_HELP) return(showhelp());
135
  if (action == ACTION_HELP) return(showhelp());
137
 
136
 
138
  /* allocate some bits for cfg file's location */
137
  /* allocate some bits for cfg file's location */
Line 149... Line 148...
149
  }
148
  }
150
 
149
 
151
  /* load configuration */
150
  /* load configuration */
152
  flags = 0;
151
  flags = 0;
153
  dirlist = NULL;
152
  dirlist = NULL;
154
  if (loadconf(cfgfile, NULL, 0, NULL, NULL, &dirlist, &flags, NULL, NULL, &mapdrv) < 0) return(5);
153
  if (loadconf(cfgfile, &dirlist, &flags) < 0) return(5);
155
 
154
 
156
  /* free the cfgfile buffer, I won't need the config file's location any more */
155
  /* free the cfgfile buffer, I won't need the config file's location any more */
157
  free(cfgfile);
156
  free(cfgfile);
158
  cfgfile = NULL;
157
  cfgfile = NULL;
159
 
158
 
160
  switch (action) {
159
  switch (action) {
161
    case ACTION_INSTALL:
160
    case ACTION_INSTALL:
162
      res = pkginst(argv[2], flags, dosdir, tempdir, dirlist, mapdrv);
161
      res = pkginst(argv[2], flags, dosdir, tempdir, dirlist);
163
      break;
162
      break;
164
    case ACTION_REMOVE:
163
    case ACTION_REMOVE:
165
      res = pkgrem(argv[2], dosdir, mapdrv);
164
      res = pkgrem(argv[2], dosdir);
166
      break;
165
      break;
167
    default:
166
    default:
168
      res = showhelp();
167
      res = showhelp();
169
      break;
168
      break;
170
  }
169
  }