Line 165... |
Line 165... |
165 |
}
|
165 |
}
|
166 |
|
166 |
|
167 |
|
167 |
|
168 |
/* prepare a package for installation. this is mandatory before actually installing it!
|
168 |
/* prepare a package for installation. this is mandatory before actually installing it!
|
169 |
* returns a pointer to the zip file's index on success, NULL on failure. the **zipfd pointer is updated with a file descriptor to the open zip file to install. */
|
169 |
* returns a pointer to the zip file's index on success, NULL on failure. the **zipfd pointer is updated with a file descriptor to the open zip file to install. */
|
170 |
struct ziplist *pkginstall_preparepackage(char *pkgname, char *localfile, int flags, FILE **zipfd, char *dosdir, struct customdirs *dirlist, char *buffmem1k) {
|
170 |
struct ziplist *pkginstall_preparepackage(const char *pkgname, const char *zipfile, int flags, FILE **zipfd, const char *dosdir, const struct customdirs *dirlist, char *buffmem1k) {
|
171 |
char *fname;
|
171 |
char *fname;
|
172 |
char *zipfile;
|
- |
|
173 |
char *appinfofile;
|
172 |
char *appinfofile;
|
174 |
int appinfopresence;
|
173 |
int appinfopresence;
|
175 |
char *shortfile;
|
174 |
char *shortfile;
|
176 |
struct ziplist *ziplinkedlist = NULL, *curzipnode, *prevzipnode;
|
175 |
struct ziplist *ziplinkedlist = NULL, *curzipnode, *prevzipnode;
|
177 |
struct flist_t *flist = NULL;
|
176 |
struct flist_t *flist = NULL;
|
178 |
|
177 |
|
179 |
fname = buffmem1k;
|
178 |
fname = buffmem1k;
|
180 |
zipfile = buffmem1k + 256;
|
- |
|
181 |
appinfofile = buffmem1k + 512;
|
179 |
appinfofile = buffmem1k + 512;
|
182 |
|
180 |
|
183 |
strtolower(pkgname); /* convert pkgname to lower case, because the http repo is probably case sensitive */
|
- |
|
184 |
sprintf(appinfofile, "appinfo\\%s.lsm", pkgname); /* Prepare the appinfo/xxxx.lsm filename string for later use */
|
181 |
sprintf(appinfofile, "appinfo\\%s.lsm", pkgname); /* Prepare the appinfo/xxxx.lsm filename string for later use */
|
185 |
|
182 |
|
186 |
/* check if not already installed, if already here, print a message "you might want to use update instead"
|
183 |
/* check if not already installed, if already here, print a message "you might want to use update instead"
|
187 |
* of course this must not be done if we are in the process of upgrading said package */
|
184 |
* of course this must not be done if we are in the process of upgrading said package */
|
188 |
if (((flags & PKGINST_UPDATE) == 0) && (validate_package_not_installed(pkgname, dosdir) != 0)) {
|
185 |
if (((flags & PKGINST_UPDATE) == 0) && (validate_package_not_installed(pkgname, dosdir) != 0)) {
|
189 |
return(NULL);
|
186 |
return(NULL);
|
190 |
}
|
187 |
}
|
191 |
|
188 |
|
192 |
if (localfile != NULL) { /* if it's a local file, then we will have to skip all the network stuff */
|
- |
|
193 |
strcpy(zipfile, localfile);
|
- |
|
194 |
} else {
|
- |
|
195 |
zipfile[0] = 0;
|
- |
|
196 |
}
|
- |
|
197 |
|
- |
|
198 |
/* Now let's check the content of the zip file */
|
189 |
/* Now let's check the content of the zip file */
|
199 |
|
190 |
|
200 |
*zipfd = fopen(zipfile, "rb");
|
191 |
*zipfd = fopen(zipfile, "rb");
|
201 |
if (*zipfd == NULL) {
|
192 |
if (*zipfd == NULL) {
|
202 |
kitten_puts(3, 8, "Error: Invalid zip archive! Package not installed.");
|
193 |
kitten_puts(3, 8, "Error: Invalid zip archive! Package not installed.");
|