From cf144a3d4a16e1dabc72f07df17ebf819368f3bf Mon Sep 17 00:00:00 2001 From: Satoshi Asami Date: Sat, 5 Dec 1998 06:29:03 +0000 Subject: [PATCH] Fix support for uncompressed (".tar") package types. It's not completely fixed (chained dependency checking for pkg_add is broken, for one thing) but at least you can now create one package and use it. --- usr.sbin/pkg_install/create/perform.c | 26 +++++++++++++++++++++----- usr.sbin/pkg_install/lib/file.c | 6 +++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index 6d13be57f7eb..d68cc0073b45 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -1,6 +1,6 @@ #ifndef lint static const char rcsid[] = - "$Id: perform.c,v 1.44 1998/09/08 10:42:24 jkh Exp $"; + "$Id: perform.c,v 1.45 1998/09/11 07:26:57 jkh Exp $"; #endif /* @@ -45,6 +45,8 @@ pkg_perform(char **pkgs) FILE *pkg_in, *fp; Package plist; int len; + char *suf; + int compress; /* Preliminary setup */ sanity_check(); @@ -63,10 +65,24 @@ pkg_perform(char **pkgs) } plist.head = plist.tail = NULL; - /* chop suffix off if already specified */ + /* chop suffix off if already specified, remembering if we want to compress */ len = strlen(pkg); - if (len > 4 && !strcmp(&pkg[len - 4], ".tgz")) - pkg[len - 4] = '\0'; + if (len > 4) + if (!strcmp(&pkg[len - 4], ".tgz")) { + compress = TRUE; + pkg[len - 4] = '\0'; + } + else if (!strcmp(&pkg[len - 4], ".tar")) { + compress = FALSE; + pkg[len - 4] = '\0'; + } + else + /* default is to compress packages */ + compress = TRUE; + if (compress) + suf = "tgz"; + else + suf = "tar"; /* Stick the dependencies, if any, at the top */ if (Pkgdeps) { @@ -176,7 +192,7 @@ pkg_perform(char **pkgs) } /* And stick it into a tar ball */ - make_dist(home, pkg, "tgz", &plist); + make_dist(home, pkg, suf, &plist); /* Cleanup */ free(Comment); diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index c12b35ca03dd..9aed73cf3999 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -1,6 +1,6 @@ #ifndef lint static const char rcsid[] = - "$Id: file.c,v 1.33 1998/10/09 00:01:16 jkh Exp $"; + "$Id: file.c,v 1.34 1998/10/14 18:52:04 jkh Exp $"; #endif /* @@ -487,8 +487,8 @@ unpack(char *pkg, char *flist) } } else - strcpy(args, "z"); - strcat(args, "xpf"); + strcpy(args, "-z"); + strcat(args, " -xpf"); if (vsystem("tar %s %s %s", args, pkg, flist ? flist : "")) { warnx("tar extract of %s failed!", pkg); return 1;