6,6 → 6,7 |
#include "7zCrc.h" |
#include "7zFile.h" |
#include "7zVersion.h" |
#include "http.h" |
#include "package.h" |
|
#define PERIOD_4 (4 * 365 + 1) |
323,11 → 324,11 |
} |
|
|
|
void do_install(list_t *install) |
void do_7z_unpack(const char *srcpath) |
{ |
CFileInStream archiveStream; |
CLookToRead lookStream; |
|
CSzArEx db; |
SRes res; |
ISzAlloc allocImp; |
335,8 → 336,7 |
UInt16 *temp = NULL; |
size_t tempSize = 0; |
|
package_t *pkg, *tmp; |
char *cache_path; |
memset(&lookStream,0,sizeof(lookStream)); |
|
allocImp.Alloc = SzAlloc; |
allocImp.Free = SzFree; |
344,19 → 344,15 |
allocTempImp.Alloc = SzAllocTemp; |
allocTempImp.Free = SzFreeTemp; |
|
list_for_each_entry_safe(pkg, tmp, install, list) |
{ |
cache_path = make_cache_path(pkg->filename); |
if (InFile_Open(&archiveStream.file, srcpath)) |
return; |
|
if (InFile_Open(&archiveStream.file, cache_path)) |
continue; |
|
FileInStream_CreateVTable(&archiveStream); |
LookToRead_CreateVTable(&lookStream, False); |
|
lookStream.realStream = &archiveStream.s; |
LookToRead_Init(&lookStream); |
|
CrcGenerateTable(); |
SzArEx_Init(&db); |
|
res = SzArEx_Open(&db, &lookStream.s, &allocImp, &allocTempImp); |
421,15 → 417,10 |
for (j = 0; name[j] != 0; j++) |
if (name[j] == '/') |
{ |
if (1) |
{ |
name[j] = 0; |
MyCreateDir(name); |
name[j] = CHAR_PATH_SEPARATOR; |
} |
else |
destPath = name + j + 1; |
} |
|
if (isDir) |
{ |
448,7 → 439,7 |
|
if (File_Write(&outFile, outBuffer + offset, &processedSize) != 0 || processedSize != outSizeProcessed) |
{ |
PrintError("can not write output file"); |
PrintError("can not write output file\n"); |
res = SZ_ERROR_FAIL; |
break; |
} |
455,15 → 446,34 |
|
if (File_Close(&outFile)) |
{ |
PrintError("can not close output file"); |
PrintError("can not close output file\n"); |
res = SZ_ERROR_FAIL; |
break; |
} |
}; |
continue; |
}; |
IAlloc_Free(&allocImp, outBuffer); |
}; |
SzArEx_Free(&db, &allocImp); |
SzFree(NULL, temp); |
|
File_Close(&archiveStream.file); |
}; |
|
void do_install(list_t *install) |
{ |
package_t *pkg, *tmp; |
char *cache_path; |
|
list_for_each_entry_safe(pkg, tmp, install, list) |
{ |
cache_path = make_cache_path(pkg->filename); |
|
sprintf(conbuf,"install package %s-%s\n", pkg->name, pkg->version); |
con_write_asciiz(conbuf); |
|
do_7z_unpack(cache_path); |
list_del_pkg(pkg); |
}; |
}; |
|