Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 271 → Rev 272

/pkg/libunzip.c
88,7 → 88,8
/* create new entry and link it into the list */
newentry = calloc(sizeof(struct ziplist) + filenamelen, 1);
if (newentry == NULL) {
kitten_puts(8, 0, "Out of memory!");
kitten_printf(2, 14, "Out of memory! (%s)", "libunzip");
puts("");
zip_freelist(&reslist);
break;
}
/pkg/libunzip.h
24,7 → 24,7
struct ziplist *nextfile;
time_t timestamp; /* the timestamp of the file */
short compmethod;
unsigned char flags; /* zero for files, non-zero for directories */
unsigned char flags; /* see ZIP_FLAG_xxx above */
char filename[1]; /* must be last element (gets expanded at runtime) */
};
 
/pkg/loadconf.c
29,7 → 29,7
for (; dirlist != NULL; dirlist = dirlist->next) {
for (curpos = dirlist->next; curpos != NULL; curpos = curpos->next) {
if (strcasecmp(curpos->name, dirlist->name) == 0) {
kitten_printf(7, 0, "Error: custom dir '%s' is listed twice!", curpos->name);
kitten_printf(7, 0, "ERROR: custom dir '%s' is listed twice!", curpos->name);
puts("");
return(-1);
}
44,7 → 44,7
for (; dirlist != NULL; dirlist = dirlist->next) {
/* the location must be at least 3 characters long to be a valid absolute path (like 'c:\')*/
if (strlen(dirlist->location) < 3) {
kitten_printf(7, 15, "Error: custom dir '%s' is not a valid absolute path!", dirlist->name);
kitten_printf(7, 15, "ERROR: custom dir '%s' is not a valid absolute path!", dirlist->name);
puts("");
return(-1);
}
52,7 → 52,7
if ((dirlist->location[1] != ':') ||
((dirlist->location[2] != '/') && (dirlist->location[2] != '\\')) ||
(((dirlist->location[0] < 'a') || (dirlist->location[0] > 'z')) && ((dirlist->location[0] < 'A') || (dirlist->location[0] > 'Z')))) {
kitten_printf(7, 15, "Error: custom dir '%s' is not a valid absolute path!", dirlist->name);
kitten_printf(7, 15, "ERROR: custom dir '%s' is not a valid absolute path!", dirlist->name);
puts("");
return(-1);
}
63,7 → 63,7
(strcasecmp(dirlist->name, "help") == 0) ||
(strcasecmp(dirlist->name, "nls") == 0) ||
(strcasecmp(dirlist->name, "packages") == 0)) {
kitten_printf(7, 16, "Error: custom dir '%s' is a reserved name!", dirlist->name);
kitten_printf(7, 16, "ERROR: custom dir '%s' is a reserved name!", dirlist->name);
puts("");
return(-1);
}
96,7 → 96,7
snprintf(token, sizeof(token), "%s\\cfg\\pkg.cfg", dosdir);
fd = fopen(token, "r");
if (fd == NULL) {
kitten_printf(7, 1, "Error: Could not open config file (%s)!", token);
kitten_printf(7, 1, "ERROR: Could not open config file (%s)!", token);
puts("");
return(-1);
}
/pkg/main.c
49,19 → 49,18
 
 
static int showhelp(void) {
printf("PKG ver " PVER " Copyright (C) " PDATE " Mateusz Viste\n"
"\n"
"PKG is the package installer for SvarDOS.\n"
"\n"
"Usage: pkg install package.zip\n"
" pkg update package.zip\n"
" pkg remove package\n"
" pkg listfiles package\n"
" pkg listlocal [filter]\n"
"\n"
"PKG is published under the MIT license. It uses a configuration file\n"
"located at %%DOSDIR%%\\CFG\\PKG.CFG\n"
);
puts("PKG ver " PVER " Copyright (C) " PDATE " Mateusz Viste");
puts("");
kitten_puts(1, 0, "PKG is the package installer for SvarDOS.");
puts("");
kitten_puts(1, 20, "Usage: pkg install package.zip");
kitten_puts(1, 21, " pkg update package.zip");
kitten_puts(1, 22, " pkg remove package");
kitten_puts(1, 23, " pkg listfiles package");
kitten_puts(1, 24, " pkg listlocal [filter]");
puts("");
kitten_puts(1, 25, "PKG is published under the MIT license.");
kitten_puts(1, 26, "It is configured through %DOSDIR%\\CFG\\PKG.CFG");
return(1);
}
 
/pkg/nls/pkg.en
1,5 → 1,5
#
# PKGINST language file
# PKG language file
#
# Language..: English
# Codepage..: 437
9,71 → 9,33
 
#### Help ####
 
1.0:This is a network package manager for FreeDOS.
1.1:Usage: FDNPKG action [parameters]
1.2:Where action is one of the following:
1.3: search [string] - search net repositories for package containing 'string'
1.4: vsearch [string] - same as 'search', but prints also source repositories
1.5: install pkg - install the package 'pkgname' (or local zip file)
1.6: remove pkg - remove the package 'pkgname'
1.7: dumpcfg - print out the configuration loaded from the cfg file
1.8: license - print out the license of this program
1.9:FDNPKG is linked against WatTCP version below:
1.10: install-nosrc pkg - install the package 'pkg' (or local zip file) w/o sources
1.11: install-wsrc pkg - install the package 'pkg' (or local zip file) with sources
1.12: showinstalled [str] - show the list of all installed packages containing 'str'
1.13: checkupdates - check for available updates of packages and display them
1.14: update pkg - update the 'pkg' package to a newer version
1.15: update [pkg] - update 'pkg' to last version (or all packages if no arg)
1.16: listlocal [str] - list all local (installed) packages containing 'str'
1.17:FDNPKG is linked against the Watt-32 version below:
1.18: listfiles pkg - list files owned by the package 'pkg'
1.19: clearcache - clear FDNPKG's local cache
1.0:PKG is the package installer for SvarDOS.
1.20:Usage: pkg install package.zip
1.21: pkg update package.zip
1.22: pkg remove package
1.23: pkg listfiles package
1.24: pkg listlocal [filter]
1.25:PKG is published under the MIT license.
1.26:It is configured through %DOSDIR%\\CFG\\PKG.CFG
 
 
### General stuff ####
 
2.0:%TEMP% not set! You should make it point to a writeable directory.
2.1:Example: SET TEMP=C:\\TEMP
2.2:%DOSDIR% not set! You should make it point to the FreeDOS main directory.
2.3:Example: SET DOSDIR=C:\\FDOS
2.4:Invalid number of arguments. Run fdnpkg without any parameter for help.
2.5:No repository is configured. You need at least one.
2.6:You should place in your configuration file at least one entry of such form:
2.7:REPO www.freedos.org/repo
2.8:The list of configured fdnpkg repositories follows:
2.9:Refreshing %s...
2.10:Repository download failed!
2.11:An error occured while trying to load repository from tmp file...
2.12:Warning: %TZ% not set! timestamps on installed files might be inaccurate.
2.13:Package database loaded from local cache.
2.14:Out of memory! (%s)
2.15:Error: TCP/IP initialization failed!
2.16:Loading %s...
2.17:WARNING: Virtual memory too low. FDNPKG might behave unreliably.
2.18:ERROR: Unable to write in the '%s' directory. Check your %%TEMP%% variable.
2.19:Cache cleared.
 
 
#### Installing package ####
 
3.0:Package %s is already installed! Remove it first if you need to upgrade.
3.8:Error: Invalid zip archive! Package not installed.
3.9:Error: Package contains a file that already exists locally:
3.10:Error: Could not create %s!
3.11:Package %s installed.
3.12:Error: Package does not contain the %s file! Not a valid FreeDOS package.
3.13:Error: Downloaded package had wrong CRC. Installation aborted.
3.14:Error: Failed to open the downloaded package. Installation aborted.
3.15:Error: Out of memory while computing the CRC of the package!
3.16:Package %s installed (with sources, if available).
3.17:Package %s installed (without sources).
3.8:ERROR: Invalid zip archive! Package not installed.
3.9:ERROR: Package contains a file that already exists locally:
3.10:ERROR: Could not create %s!
3.12:ERROR: Package does not contain the %s file! Not a valid FreeDOS package.
3.18:Package %s is already installed! You might want to use the 'update' action.
3.19:Package %s installed: %d files extracted, %d errors.
3.20:Error: Package contains an encrypted file:
3.21:Error: Failed to open link file '%s' for read access.
3.22:Error: Failed to open link file '%s' for write access.
3.23:Error: Package contains an invalid filename:
3.20:ERROR: Package contains an encrypted file:
3.23:ERROR: Package contains an invalid filename:
3.24:ERROR: package name too long
 
 
80,8 → 42,6
#### Removing package ####
 
4.0:Package %s is not installed, so not removed.
4.1:Error opening lst file!
4.2:Dirlist limit reached. Directory %s won't be removed!
4.3:Out of memory! Could not store directory %s!
4.4:removing %s
4.5:Package %s has been removed.
90,35 → 50,27
#### Searching package ####
 
5.0:No package matched the search.
5.1:Out of memory while processing package descriptions!
 
 
#### Loading configuration ####
 
7.1:Error: Could not open config file '%s'!
7.2:Warning: token without value on line #%d
7.3:Warning: Config file token overflow on line #%d
7.0:ERROR: custom dir '%s' is listed twice!
7.1:ERROR: Could not open config file '%s'!
7.4:Warning: token with empty value on line #%d
7.5:Warning: trailing white-space(s) after value on line #%d
7.8:Warning: Unknown token '%s' at line #%d
7.9:Warning: Config file value overflow on line #%d
7.10:Warning: Ignored an illegal '%s' value at line #%d
7.11:Warning: Invalid 'DIR' directive found at line #%d
7.12:Error: DIR path too long at line #%d
7.13:Error: Found inexisting environnement variable '%s' at line #%d
7.15:Error: custom dir '%s' is not a valid absolute path!
7.16:Error: custom dir '%s' is a reserved name!
7.15:ERROR: custom dir '%s' is not a valid absolute path!
7.16:ERROR: custom dir '%s' is a reserved name!
 
 
#### Unziping package ####
 
8.0:Out of memory!
8.1:unknown zip sig: 0x%08lx
8.2:Error: Package contains a file compressed with an unsupported method (%d):
8.3:Error while extracting '%s' to '%s'!
8.2:ERROR: Package contains a file compressed with an unsupported method (%d):
8.3:ERROR: failed extracting '%s' to '%s'!
 
 
#### Handling the local list of installed packages ####
 
9.0:Error: Could not access the %s directory.
9.1:Error: Local package %s not found.
9.0:ERROR: Could not access directory %s
9.1:ERROR: Local package '%s' not found.
/pkg/pkginst.c
115,12 → 115,12
 
*zipfd = fopen(zipfile, "rb");
if (*zipfd == NULL) {
kitten_puts(3, 8, "Error: Invalid zip archive! Package not installed.");
kitten_puts(3, 8, "ERROR: Invalid zip archive! Package not installed.");
goto RAII;
}
ziplinkedlist = zip_listfiles(*zipfd);
if (ziplinkedlist == NULL) {
kitten_puts(3, 8, "Error: Invalid zip archive! Package not installed.");
kitten_puts(3, 8, "ERROR: Invalid zip archive! Package not installed.");
goto RAII;
}
/* if updating, load the list of files belonging to the current package */
157,7 → 157,7
}
/* validate that the file has a valid filename (8+3, no shady chars...) */
if (validfilename(curzipnode->filename) != 0) {
kitten_puts(3, 23, "Error: Package contains an invalid filename:");
kitten_puts(3, 23, "ERROR: Package contains an invalid filename:");
printf(" %s\n", curzipnode->filename);
goto RAII_ERR;
}
166,13 → 166,13
shortfile = computelocalpath(curzipnode->filename, fname, dosdir, dirlist);
strcat(fname, shortfile);
if ((findfileinlist(flist, fname) == NULL) && (fileexists(fname) != 0)) {
kitten_puts(3, 9, "Error: Package contains a file that already exists locally:");
kitten_puts(3, 9, "ERROR: Package contains a file that already exists locally:");
printf(" %s\n", fname);
goto RAII_ERR;
}
/* abort if any entry is encrypted */
if ((curzipnode->flags & ZIP_FLAG_ENCRYPTED) != 0) {
kitten_printf(3, 20, "Error: Package contains an encrypted file:");
kitten_printf(3, 20, "ERROR: Package contains an encrypted file:");
puts("");
printf(" %s\n", curzipnode->filename);
goto RAII_ERR;
179,7 → 179,7
}
/* abort if any file is compressed with an unsupported method */
if ((curzipnode->compmethod != 0/*store*/) && (curzipnode->compmethod != 8/*deflate*/)) { /* unsupported compression method */
kitten_printf(8, 2, "Error: Package contains a file compressed with an unsupported method (%d):", curzipnode->compmethod);
kitten_printf(8, 2, "ERROR: Package contains a file compressed with an unsupported method (%d):", curzipnode->compmethod);
puts("");
printf(" %s\n", curzipnode->filename);
goto RAII_ERR;
190,7 → 190,7
}
/* if appinfo file not found, this is not a real FreeDOS package */
if (appinfopresence != 1) {
kitten_printf(3, 12, "Error: Package do not contain the %s file! Not a valid FreeDOS package.", appinfofile);
kitten_printf(3, 12, "ERROR: Package do not contain the %s file! Not a valid FreeDOS package.", appinfofile);
puts("");
goto RAII_ERR;
}
227,7 → 227,8
buff = malloc(512);
fulldestfilename = malloc(1024);
if ((buff == NULL) || (fulldestfilename == NULL)) {
kitten_puts(8, 0, "Out of memory!");
kitten_printf(2, 14, "Out of memory! (%s)", "fulldestfilename");
puts("");
zip_freelist(&ziplinkedlist);
free(buff);
free(fulldestfilename);
242,7 → 243,7
sprintf(buff, "%s\\%s", dosdir, packageslst);
lstfd = fopen(buff, "wb"); /* opening it in binary mode, because I like to have control over line terminators (CR/LF) */
if (lstfd == NULL) {
kitten_printf(3, 10, "Error: Could not create %s!", buff);
kitten_printf(3, 10, "ERROR: Could not create %s!", buff);
puts("");
zip_freelist(&ziplinkedlist);
free(buff);
264,7 → 265,7
/* Now unzip the file */
unzip_result = zip_unzip(zipfd, curzipnode, fulldestfilename);
if (unzip_result != 0) {
kitten_printf(8, 3, "Error while extracting '%s' to '%s'!", curzipnode->filename, fulldestfilename);
kitten_printf(8, 3, "ERROR: failed extracting '%s' to '%s'!", curzipnode->filename, fulldestfilename);
printf(" [%d]\n", unzip_result);
filesextractedfailure += 1;
} else {
/pkg/showinst.c
28,7 → 28,7
sprintf(buff, "%s\\packages", dosdir);
dp = opendir(buff);
if (dp == NULL) {
kitten_printf(9, 0, "Error: Could not access directory %s", buff);
kitten_printf(9, 0, "ERROR: Could not access directory %s", buff);
puts("");
return(-1);
}
78,7 → 78,7
sprintf(buff, "%s\\packages\\%s.lst", dosdir, pkgname);
fd = fopen(buff, "rb");
if (fd == NULL) {
kitten_printf(9, 1, "Error: Local package %s not found.", pkgname);
kitten_printf(9, 1, "ERROR: Local package '%s' not found.", pkgname);
puts("");
return(NULL);
}