sync with src:
don't explicitly call gunzip, just pass the right arguments to tar. fixes package decompression on Solaris where gunzip is not available (but gzip is), and also decompression of bzip2 packages on non-NetBSD.
This commit is contained in:
parent
9d94b6fd74
commit
572d0d01db
2 changed files with 22 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ftpio.c,v 1.10 2004/08/20 20:09:53 jlam Exp $ */
|
||||
/* $NetBSD: ftpio.c,v 1.11 2004/10/31 02:48:12 grant Exp $ */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
@ -8,7 +8,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: ftpio.c,v 1.10 2004/08/20 20:09:53 jlam Exp $");
|
||||
__RCSID("$NetBSD: ftpio.c,v 1.11 2004/10/31 02:48:12 grant Exp $");
|
||||
#endif
|
||||
|
||||
/*-
|
||||
|
@ -1221,12 +1221,29 @@ unpackURL(const char *url, const char *dir)
|
|||
|
||||
{
|
||||
char cmd[1024];
|
||||
const char *decompress_cmd = NULL;
|
||||
const char *suf;
|
||||
|
||||
if (Verbose)
|
||||
printf("unpackURL '%s' to '%s'\n", url, dir);
|
||||
|
||||
suf = suffix_of(pkg);
|
||||
if (!strcmp(suf, "tbz") || !strcmp(suf, "bz2"))
|
||||
decompress_cmd = BZIP2_CMD;
|
||||
else if (!strcmp(suf, "tgz") || !strcmp(suf, "gz"))
|
||||
decompress_cmd = GZIP_CMD;
|
||||
else if (!strcmp(suf, "tar"))
|
||||
; /* do nothing */
|
||||
else
|
||||
errx(EXIT_FAILURE, "don't know how to decompress %s, sorry", pkg);
|
||||
|
||||
/* yes, this is gross, but needed for borken ftp(1) */
|
||||
(void) snprintf(cmd, sizeof(cmd), "get %s \"| ( cd %s ; gunzip 2>/dev/null | " TAR_CMD " -%sx -f - | tee /dev/stderr )\"\n", pkg, dir, Verbose?"vv":"");
|
||||
(void) snprintf(cmd, sizeof(cmd), "get %s \"| ( cd %s; " TAR_CMD " %s %s -%sx -f - | tee /dev/stderr )\"\n",
|
||||
pkg, dir,
|
||||
decompress_cmd != NULL ? "--use-compress-program" : "",
|
||||
decompress_cmd != NULL ? decompress_cmd : "",
|
||||
Verbose? "vv" : "");
|
||||
|
||||
rc = ftp_cmd(cmd, "\n(226|550).*\n");
|
||||
if (rc != 226) {
|
||||
warnx("Cannot fetch file (%d!=226)!", rc);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: version.h,v 1.33 2004/08/20 20:09:53 jlam Exp $ */
|
||||
/* $NetBSD: version.h,v 1.34 2004/10/31 02:48:12 grant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
|
||||
|
@ -33,6 +33,6 @@
|
|||
#ifndef _INST_LIB_VERSION_H_
|
||||
#define _INST_LIB_VERSION_H_
|
||||
|
||||
#define PKGTOOLS_VERSION "20040813"
|
||||
#define PKGTOOLS_VERSION "20041031"
|
||||
|
||||
#endif /* _INST_LIB_VERSION_H_ */
|
||||
|
|
Loading…
Reference in a new issue