summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_install/add/main.c6
-rw-r--r--usr.sbin/pkg_install/add/perform.c5
-rw-r--r--usr.sbin/pkg_install/lib/file.c13
3 files changed, 15 insertions, 9 deletions
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index 2ebf912..92ea7bf 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -151,8 +151,10 @@ main(int argc, char **argv)
errx(1, "package name too long");
remotepkg = temppackageroot;
if (!((ptr = strrchr(remotepkg, '.')) && ptr[1] == 't' &&
- ptr[2] == 'g' && ptr[3] == 'z' && !ptr[4]))
- if (strlcat(remotepkg, ".tgz", sizeof(temppackageroot))
+ (ptr[2] == 'b' || ptr[2] == 'g') && ptr[3] == 'z' &&
+ !ptr[4]))
+ /* XXX: need to handle .tgz also */
+ if (strlcat(remotepkg, ".tbz", sizeof(temppackageroot))
>= sizeof(temppackageroot))
errx(1, "package name too long");
}
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c
index d707ec6..e1ef7a3 100644
--- a/usr.sbin/pkg_install/add/perform.c
+++ b/usr.sbin/pkg_install/add/perform.c
@@ -97,7 +97,7 @@ pkg_do(char *pkg)
}
/* Nope - do it now */
else {
- /* Is it an ftp://foo.bar.baz/file.tgz specification? */
+ /* Is it an ftp://foo.bar.baz/file.t[bg]z specification? */
if (isURL(pkg)) {
if (!(Home = fileGetURL(NULL, pkg))) {
warnx("unable to fetch '%s' by URL", pkg);
@@ -267,7 +267,8 @@ pkg_do(char *pkg)
if (!Fake) {
if (!isURL(pkg) && !getenv("PKG_ADD_BASE")) {
- snprintf(path, FILENAME_MAX, "%s/%s.tgz", getenv("_TOP"), p->name);
+ /* XXX: need to handle .tgz also */
+ snprintf(path, FILENAME_MAX, "%s/%s.tbz", getenv("_TOP"), p->name);
if (fexists(path))
cp = path;
else
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c
index 7150458..1878a89 100644
--- a/usr.sbin/pkg_install/lib/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -176,7 +176,8 @@ fileGetURL(const char *base, const char *spec)
*(cp + 1) = '\0';
strcat(cp, "All/");
strcat(cp, spec);
- strcat(cp, ".tgz");
+ /* XXX: need to handle .tgz also */
+ strcat(cp, ".tbz");
}
else
return NULL;
@@ -188,7 +189,8 @@ fileGetURL(const char *base, const char *spec)
*/
strcpy(fname, hint);
strcat(fname, spec);
- strcat(fname, ".tgz");
+ /* XXX: need to handle .tgz also */
+ strcat(fname, ".tbz");
}
}
else
@@ -222,7 +224,8 @@ fileGetURL(const char *base, const char *spec)
dup2(pfd[0], 0);
for (fd = getdtablesize() - 1; fd >= 3; --fd)
close(fd);
- execl("/usr/bin/tar", "tar", Verbose ? "-xzpvf" : "-xzpf", "-",
+ /* XXX: need to handle .tgz also */
+ execl("/usr/bin/tar", "tar", Verbose ? "-xjvf" : "-xzf", "-",
(char *)0);
_exit(2);
}
@@ -252,7 +255,7 @@ fileFindByPath(const char *base, const char *fname)
{
static char tmp[FILENAME_MAX];
char *cp;
- const char *suffixes[] = {".tgz", ".tar", ".tbz", NULL};
+ const char *suffixes[] = {".tbz", ".tgz", ".tar", NULL};
int i;
if (fexists(fname) && isfile(fname)) {
@@ -457,7 +460,7 @@ unpack(const char *pkg, const char *flist)
strcpy(suff, cp + 1);
if (strchr(suff, 'z') || strchr(suff, 'Z')) {
if (strchr(suff, 'b'))
- strcpy(args, "-y");
+ strcpy(args, "-j");
else
strcpy(args, "-z");
}
OpenPOWER on IntegriCloud