diff options
author | eik <eik@FreeBSD.org> | 2004-06-29 19:06:42 +0000 |
---|---|---|
committer | eik <eik@FreeBSD.org> | 2004-06-29 19:06:42 +0000 |
commit | 3883d107114d126a28a9163c5bf67cb766ec7779 (patch) | |
tree | 1ab5b5afad8e17719ffc614e8b575ec26c5c8bd5 /usr.sbin | |
parent | 338dc29a063a48607925d36ac38dd1f0263c2e8b (diff) | |
download | FreeBSD-src-3883d107114d126a28a9163c5bf67cb766ec7779.zip FreeBSD-src-3883d107114d126a28a9163c5bf67cb766ec7779.tar.gz |
- pkg_add spawns itself as argv[0] when installing dependent packages, to
enable the use as a port on older systems
- use absolute paths in all calls to external programs, to account for strange
PATH settings
- use INDEX or INDEX-5 depending on FreeBSD version, to enable the use on
FreeBSD 4.x as a port.
- conditionalize all 4.x/5.x differences on __FreeBSD_version, so that the
pkg_install tools can be kept in sync on 4.x and 5.x
- Bump PKG_INSTALL_VERSION
Reviewed by: portmgr (bento run)
MFC after: 4 weeks
Diffstat (limited to 'usr.sbin')
27 files changed, 97 insertions, 61 deletions
diff --git a/usr.sbin/pkg_install/add/Makefile b/usr.sbin/pkg_install/add/Makefile index b72511a..5f7d653 100644 --- a/usr.sbin/pkg_install/add/Makefile +++ b/usr.sbin/pkg_install/add/Makefile @@ -5,7 +5,8 @@ SRCS= main.c perform.c futil.c extract.c CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib -WARNS?= 2 +WARNS?= 6 +WFORMAT?= 1 DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} LDADD= ${LIBINSTALL} -lfetch -lmd diff --git a/usr.sbin/pkg_install/add/add.h b/usr.sbin/pkg_install/add/add.h index b64cef7..d27877a 100644 --- a/usr.sbin/pkg_install/add/add.h +++ b/usr.sbin/pkg_install/add/add.h @@ -28,12 +28,12 @@ typedef enum { NORMAL, MASTER, SLAVE } add_mode_t; extern char *Prefix; extern Boolean NoInstall; extern Boolean NoRecord; -extern Boolean Force; extern char *Mode; extern char *Owner; extern char *Group; extern char *Directory; extern char *PkgName; +extern char *PkgAddCmd; extern char FirstPen[]; extern add_mode_t AddMode; diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c index 4793dc2..0e31e06 100644 --- a/usr.sbin/pkg_install/add/extract.c +++ b/usr.sbin/pkg_install/add/extract.c @@ -27,14 +27,14 @@ __FBSDID("$FreeBSD$"); #include "add.h" -#define STARTSTRING "tar cf -" +#define STARTSTRING "/usr/bin/tar cf -" #define TOOBIG(str) \ (((int)strlen(str) + FILENAME_MAX + where_count > maxargs) ||\ ((int)strlen(str) + FILENAME_MAX + perm_count > maxargs)) #define PUSHOUT(todir) /* push out string */ \ if (where_count > (int)sizeof(STARTSTRING)-1) { \ - strcat(where_args, "|tar --unlink -xpf - -C "); \ + strcat(where_args, "|/usr/bin/tar --unlink -xpf - -C "); \ strcat(where_args, todir); \ if (system(where_args)) { \ cleanup(0); \ diff --git a/usr.sbin/pkg_install/add/futil.c b/usr.sbin/pkg_install/add/futil.c index 66ff738..e097140 100644 --- a/usr.sbin/pkg_install/add/futil.c +++ b/usr.sbin/pkg_install/add/futil.c @@ -50,7 +50,7 @@ make_hierarchy(char *dir) } } else { - if (vsystem("mkdir %s", dir)) { + if (vsystem("/bin/mkdir %s", dir)) { if (cp2) *cp2 = '/'; return FAIL; @@ -78,20 +78,20 @@ apply_perms(const char *dir, const char *arg) cd_to = dir; if (Mode) - if (vsystem("cd %s && chmod -R %s %s", cd_to, Mode, arg)) + if (vsystem("cd %s && /bin/chmod -R %s %s", cd_to, Mode, arg)) warnx("couldn't change modes of '%s' to '%s'", arg, Mode); if (Owner && Group) { - if (vsystem("cd %s && chown -R %s:%s %s", cd_to, Owner, Group, arg)) + if (vsystem("cd %s && /usr/sbin/chown -R %s:%s %s", cd_to, Owner, Group, arg)) warnx("couldn't change owner/group of '%s' to '%s:%s'", arg, Owner, Group); return; } if (Owner) { - if (vsystem("cd %s && chown -R %s %s", cd_to, Owner, arg)) + if (vsystem("cd %s && /usr/sbin/chown -R %s %s", cd_to, Owner, arg)) warnx("couldn't change owner of '%s' to '%s'", arg, Owner); return; } else if (Group) - if (vsystem("cd %s && chgrp -R %s %s", cd_to, Group, arg)) + if (vsystem("cd %s && /usr/bin/chgrp -R %s %s", cd_to, Group, arg)) warnx("couldn't change group of '%s' to '%s'", arg, Group); } diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 3ce0099..6463bc5 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -39,6 +39,7 @@ char *Mode = NULL; char *Owner = NULL; char *Group = NULL; char *PkgName = NULL; +char *PkgAddCmd = NULL; char *Directory = NULL; char FirstPen[FILENAME_MAX]; add_mode_t AddMode = NORMAL; @@ -63,10 +64,12 @@ struct { { 480000, 480099, "/packages-4.8-release" }, { 490000, 490099, "/packages-4.9-release" }, { 491000, 491099, "/packages-4.10-release" }, + { 492000, 492099, "/packages-4.11-release" }, { 500000, 500099, "/packages-5.0-release" }, { 501000, 501099, "/packages-5.1-release" }, { 502000, 502009, "/packages-5.2-release" }, { 502010, 502099, "/packages-5.2.1-release" }, + { 503000, 503099, "/packages-5.3-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, { 502100, 599000, "/packages-5-current" }, @@ -86,6 +89,12 @@ main(int argc, char **argv) char **start; char *cp, *packagesite = NULL, *remotepkg = NULL, *ptr; static char temppackageroot[MAXPATHLEN]; + static char pkgaddpath[MAXPATHLEN]; + + if (*argv[0] != '/' && strchr(argv[0], '/') != NULL) + PkgAddCmd = realpath(argv[0], pkgaddpath); + else + PkgAddCmd = argv[0]; start = argv; while ((ch = getopt(argc, argv, Options)) != -1) { @@ -168,9 +177,13 @@ main(int argc, char **argv) if (!((ptr = strrchr(remotepkg, '.')) && ptr[1] == 't' && (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)) + if (strlcat(remotepkg, +#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039 + ".tbz", +#else + ".tgz", +#endif + sizeof(temppackageroot)) >= sizeof(temppackageroot)) errx(1, "package name too long"); } if (!strcmp(*argv, "-")) /* stdin? */ diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index 8af962c..1399bd9 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -167,7 +167,7 @@ pkg_do(char *pkg) if (!isdir(p->name) && !Fake) { if (Verbose) printf("Desired prefix of %s does not exist, creating..\n", p->name); - vsystem("mkdir -p %s", p->name); + vsystem("/bin/mkdir -p %s", p->name); if (chdir(p->name) == -1) { warn("unable to change directory to '%s'", p->name); goto bomb; @@ -302,7 +302,11 @@ pkg_do(char *pkg) ext = strrchr(pkg_fullname, '.'); if (ext == NULL) +#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039 ext = ".tbz"; +#else + ext = ".tgz"; +#endif snprintf(path, FILENAME_MAX, "%s/%s%s", getenv("_TOP"), p->name, ext); if (fexists(path)) cp = path; @@ -311,7 +315,7 @@ pkg_do(char *pkg) if (cp) { if (Verbose) printf("Loading it from %s.\n", cp); - if (vsystem("pkg_add %s'%s'", Verbose ? "-v " : "", cp)) { + if (vsystem("%s %s'%s'", PkgAddCmd, Verbose ? "-v " : "", cp)) { warnx("autoload of dependency '%s' failed%s", cp, Force ? " (proceeding anyway)" : "!"); if (!Force) @@ -334,7 +338,7 @@ pkg_do(char *pkg) if (!Force) ++code; } - else if (vsystem("(pwd; cat +CONTENTS) | pkg_add %s-S", Verbose ? "-v " : "")) { + else if (vsystem("(pwd; /bin/cat +CONTENTS) | %s %s-S", PkgAddCmd, Verbose ? "-v " : "")) { warnx("pkg_add of dependency '%s' failed%s", p->name, Force ? " (proceeding anyway)" : "!"); if (!Force) @@ -365,7 +369,7 @@ pkg_do(char *pkg) /* Look for the requirements file */ if (fexists(REQUIRE_FNAME)) { - vsystem("chmod +x %s", REQUIRE_FNAME); /* be sure */ + vsystem("/bin/chmod +x %s", REQUIRE_FNAME); /* be sure */ if (Verbose) printf("Running requirements file first for %s..\n", Plist.name); if (!Fake && vsystem("./%s %s INSTALL", REQUIRE_FNAME, Plist.name)) { @@ -398,7 +402,7 @@ pkg_do(char *pkg) /* If we're really installing, and have an installation file, run it */ if (!NoInstall && fexists(pre_script)) { - vsystem("chmod +x %s", pre_script); /* make sure */ + vsystem("/bin/chmod +x %s", pre_script); /* make sure */ if (Verbose) printf("Running pre-install for %s..\n", Plist.name); if (!Fake && vsystem("./%s %s %s", pre_script, Plist.name, pre_arg)) { @@ -427,7 +431,7 @@ pkg_do(char *pkg) /* Run the installation script one last time? */ if (!NoInstall && fexists(post_script)) { - vsystem("chmod +x %s", post_script); /* make sure */ + vsystem("/bin/chmod +x %s", post_script); /* make sure */ if (Verbose) printf("Running post-install for %s..\n", Plist.name); if (!Fake && vsystem("./%s %s %s", post_script, Plist.name, post_arg)) { @@ -457,7 +461,7 @@ pkg_do(char *pkg) goto success; /* close enough for government work */ } /* Make sure pkg_info can read the entry */ - vsystem("chmod a+rx %s", LogDir); + vsystem("/bin/chmod a+rx %s", LogDir); move_file(".", DESC_FNAME, LogDir); move_file(".", COMMENT_FNAME, LogDir); if (fexists(INSTALL_FNAME)) diff --git a/usr.sbin/pkg_install/create/Makefile b/usr.sbin/pkg_install/create/Makefile index 5919769..16f2bc2 100644 --- a/usr.sbin/pkg_install/create/Makefile +++ b/usr.sbin/pkg_install/create/Makefile @@ -5,7 +5,8 @@ SRCS= main.c perform.c pl.c CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib -WARNS?= 2 +WARNS?= 6 +WFORMAT?= 1 DPADD= ${LIBINSTALL} ${LIBMD} LDADD= ${LIBINSTALL} -lmd diff --git a/usr.sbin/pkg_install/create/create.h b/usr.sbin/pkg_install/create/create.h index e6c3be2..b2a2b4a 100644 --- a/usr.sbin/pkg_install/create/create.h +++ b/usr.sbin/pkg_install/create/create.h @@ -50,7 +50,6 @@ extern enum zipper Zipper; void add_cksum(Package *, PackingList, const char *); void check_list(const char *, Package *); -int pkg_perform(char **); void copy_plist(const char *, Package *); #endif /* _INST_CREATE_H_INCLUDE */ diff --git a/usr.sbin/pkg_install/create/pl.c b/usr.sbin/pkg_install/create/pl.c index bdbd8a1..52a0082 100644 --- a/usr.sbin/pkg_install/create/pl.c +++ b/usr.sbin/pkg_install/create/pl.c @@ -103,18 +103,18 @@ trylink(const char *from, const char *to) /* try making the container directory */ char *cp = strrchr(to, '/'); if (cp) - vsystem("mkdir -p %.*s", cp - to, + vsystem("/bin/mkdir -p %.*s", cp - to, to); return link(from, to); } return -1; } -#define STARTSTRING "tar cf -" +#define STARTSTRING "/usr/bin/tar cf -" #define TOOBIG(str) (int)strlen(str) + 6 + (int)strlen(home) + where_count > maxargs #define PUSHOUT() /* push out string */ \ if (where_count > (int)sizeof(STARTSTRING)-1) { \ - strcat(where_args, "|tar xpf -"); \ + strcat(where_args, "|/usr/bin/tar xpf -"); \ if (system(where_args)) { \ cleanup(0); \ errx(2, "%s: can't invoke tar pipeline", __func__); \ diff --git a/usr.sbin/pkg_install/delete/Makefile b/usr.sbin/pkg_install/delete/Makefile index 5c19dba..3e8165c 100644 --- a/usr.sbin/pkg_install/delete/Makefile +++ b/usr.sbin/pkg_install/delete/Makefile @@ -5,7 +5,8 @@ SRCS= main.c perform.c CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib -WARNS?= 4 +WARNS?= 6 +WFORMAT?= 1 DPADD= ${LIBINSTALL} ${LIBMD} LDADD= ${LIBINSTALL} -lmd diff --git a/usr.sbin/pkg_install/delete/delete.h b/usr.sbin/pkg_install/delete/delete.h index a973642..e0aeca5 100644 --- a/usr.sbin/pkg_install/delete/delete.h +++ b/usr.sbin/pkg_install/delete/delete.h @@ -27,7 +27,6 @@ extern char *Prefix; extern Boolean CleanDirs; extern Boolean Interactive; extern Boolean NoDeInstall; -extern Boolean Force; extern Boolean Recursive; extern char *Directory; extern char *PkgName; diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c index 76bb734..1e40db6 100644 --- a/usr.sbin/pkg_install/delete/perform.c +++ b/usr.sbin/pkg_install/delete/perform.c @@ -224,7 +224,7 @@ pkg_do(char *pkg) if (fexists(REQUIRE_FNAME)) { if (Verbose) printf("Executing 'require' script.\n"); - vsystem("chmod +x %s", REQUIRE_FNAME); /* be sure */ + vsystem("/bin/chmod +x %s", REQUIRE_FNAME); /* be sure */ if (vsystem("./%s %s DEINSTALL", REQUIRE_FNAME, pkg)) { warnx("package %s fails requirements %s", pkg, Force ? "" : "- not deleted"); @@ -254,7 +254,7 @@ pkg_do(char *pkg) if (Fake) printf("Would execute de-install script at this point.\n"); else { - vsystem("chmod +x %s", pre_script); /* make sure */ + vsystem("/bin/chmod +x %s", pre_script); /* make sure */ if (vsystem("./%s %s %s", pre_script, pkg, pre_arg)) { warnx("deinstall script returned error status"); if (!Force) @@ -311,7 +311,7 @@ pkg_do(char *pkg) if (Fake) printf("Would execute post-deinstall script at this point.\n"); else { - vsystem("chmod +x %s", post_script); /* make sure */ + vsystem("/bin/chmod +x %s", post_script); /* make sure */ if (vsystem("./%s %s %s", post_script, pkg, post_arg)) { warnx("post-deinstall script returned error status"); if (!Force) diff --git a/usr.sbin/pkg_install/info/Makefile b/usr.sbin/pkg_install/info/Makefile index bc90013..b1fcb08 100644 --- a/usr.sbin/pkg_install/info/Makefile +++ b/usr.sbin/pkg_install/info/Makefile @@ -5,7 +5,8 @@ SRCS= main.c perform.c show.c CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib -WARNS?= 2 +WARNS?= 6 +WFORMAT?= 1 DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} LDADD= ${LIBINSTALL} -lfetch -lmd diff --git a/usr.sbin/pkg_install/lib/Makefile b/usr.sbin/pkg_install/lib/Makefile index 2a79f71..0aba9a4 100644 --- a/usr.sbin/pkg_install/lib/Makefile +++ b/usr.sbin/pkg_install/lib/Makefile @@ -7,6 +7,7 @@ SRCS= file.c msg.c plist.c str.c exec.c global.c pen.c match.c \ CFLAGS+= ${DEBUG} -WARNS?= 2 +WARNS?= 6 +WFORMAT?= 1 .include <bsd.lib.mk> diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index 107bb15..651c64b 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -269,9 +269,9 @@ copy_file(const char *dir, const char *fname, const char *to) char cmd[FILENAME_MAX]; if (fname[0] == '/') - snprintf(cmd, FILENAME_MAX, "cp -r %s %s", fname, to); + snprintf(cmd, FILENAME_MAX, "/bin/cp -r %s %s", fname, to); else - snprintf(cmd, FILENAME_MAX, "cp -r %s/%s %s", dir, fname, to); + snprintf(cmd, FILENAME_MAX, "/bin/cp -r %s/%s %s", dir, fname, to); if (vsystem(cmd)) { cleanup(0); errx(2, "%s: could not perform '%s'", __func__, cmd); @@ -284,9 +284,9 @@ move_file(const char *dir, const char *fname, const char *to) char cmd[FILENAME_MAX]; if (fname[0] == '/') - snprintf(cmd, FILENAME_MAX, "mv %s %s", fname, to); + snprintf(cmd, FILENAME_MAX, "/bin/mv %s %s", fname, to); else - snprintf(cmd, FILENAME_MAX, "mv %s/%s %s", dir, fname, to); + snprintf(cmd, FILENAME_MAX, "/bin/mv %s/%s %s", dir, fname, to); if (vsystem(cmd)) { cleanup(0); errx(2, "%s: could not perform '%s'", __func__, cmd); @@ -310,11 +310,11 @@ copy_hierarchy(const char *dir, const char *fname, Boolean to) /* If absolute path, use it */ if (*fname == '/') dir = "/"; - snprintf(cmd, FILENAME_MAX * 3, "tar cf - -C %s %s | tar xpf -", + snprintf(cmd, FILENAME_MAX * 3, "/usr/bin/tar cf - -C %s %s | /usr/bin/tar xpf -", dir, fname); } else - snprintf(cmd, FILENAME_MAX * 3, "tar cf - %s | tar xpf - -C %s", + snprintf(cmd, FILENAME_MAX * 3, "/usr/bin/tar cf - %s | /usr/bin/tar xpf - -C %s", fname, dir); #ifdef DEBUG printf("Using '%s' to copy trees.\n", cmd); @@ -350,9 +350,12 @@ unpack(const char *pkg, const char *flist) } } else - /* XXX: need to handle .tgz also */ +#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039 comp = "-j"; - if (vsystem("tar -xp %s -f '%s' %s", comp, pkg, flist ? flist : "")) { +#else + comp = "-z"; +#endif + if (vsystem("/usr/bin/tar -xp %s -f '%s' %s", comp, pkg, flist ? flist : "")) { warnx("tar extract of %s failed!", pkg); return 1; } diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 109483c..c50a944 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -52,10 +52,10 @@ #define NO 1 /* Usually "rm", but often "echo" during debugging! */ -#define REMOVE_CMD "rm" +#define REMOVE_CMD "/bin/rm" /* Usually "rm", but often "echo" during debugging! */ -#define RMDIR_CMD "rmdir" +#define RMDIR_CMD "/bin/rmdir" /* Where we put logging information by default, else ${PKG_DBDIR} if set */ #define DEF_LOG_DIR "/var/db/pkg" @@ -77,6 +77,12 @@ #define DISPLAY_FNAME "+DISPLAY" #define MTREE_FNAME "+MTREE_DIRS" +#if defined(__FreeBSD_version) && __FreeBSD_version >= 500036 +#define INDEX_FNAME "INDEX-5" +#else +#define INDEX_FNAME "INDEX" +#endif + #define CMD_CHAR '@' /* prefix for extended PLIST cmd */ /* The name of the "prefix" environment variable given to scripts */ @@ -86,7 +92,7 @@ * Version of the package tools - increase only when some * functionality used by bsd.port.mk is changed, added or removed */ -#define PKG_INSTALL_VERSION 20030417 +#define PKG_INSTALL_VERSION 20040629 #define PKG_WRAPCONF_FNAME "/var/db/pkg_install.conf" #define main(argc, argv) real_main(argc, argv) diff --git a/usr.sbin/pkg_install/lib/match.c b/usr.sbin/pkg_install/lib/match.c index 48d96cd..06e34cf 100644 --- a/usr.sbin/pkg_install/lib/match.c +++ b/usr.sbin/pkg_install/lib/match.c @@ -63,7 +63,7 @@ matchinstalled(match_t MatchType, char **patterns, int *retval) static struct store *store = NULL; FTS *ftsp; FTSENT *f; - Boolean *lmatched; + Boolean *lmatched = NULL; store = storecreate(store); if (store == NULL) { diff --git a/usr.sbin/pkg_install/lib/pen.c b/usr.sbin/pkg_install/lib/pen.c index eedda00..770235f 100644 --- a/usr.sbin/pkg_install/lib/pen.c +++ b/usr.sbin/pkg_install/lib/pen.c @@ -156,7 +156,7 @@ leave_playpen() Previous[0] = '\0'; } if (PenLocation[0]) { - if (PenLocation[0] == '/' && vsystem("rm -rf %s", PenLocation)) + if (PenLocation[0] == '/' && vsystem("/bin/rm -rf %s", PenLocation)) warnx("couldn't remove temporary dir '%s'", PenLocation); popPen(PenLocation); } diff --git a/usr.sbin/pkg_install/lib/url.c b/usr.sbin/pkg_install/lib/url.c index 5ee33f3..41017b4 100644 --- a/usr.sbin/pkg_install/lib/url.c +++ b/usr.sbin/pkg_install/lib/url.c @@ -39,7 +39,7 @@ fileGetURL(const char *base, const char *spec) char buf[8192]; FILE *ftp; pid_t tpid; - int pfd[2], pstat, r, w; + int pfd[2], pstat, r, w = 0; char *hint; int fd; @@ -69,8 +69,11 @@ fileGetURL(const char *base, const char *spec) *(cp + 1) = '\0'; strcat(cp, "All/"); strcat(cp, spec); - /* XXX: need to handle .tgz also */ +#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039 strcat(cp, ".tbz"); +#else + strcat(cp, ".tgz"); +#endif } else return NULL; @@ -82,8 +85,11 @@ fileGetURL(const char *base, const char *spec) */ strcpy(fname, hint); strcat(fname, spec); - /* XXX: need to handle .tgz also */ +#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039 strcat(fname, ".tbz"); +#else + strcat(fname, ".tgz"); +#endif } } else @@ -117,9 +123,13 @@ fileGetURL(const char *base, const char *spec) dup2(pfd[0], 0); for (fd = getdtablesize() - 1; fd >= 3; --fd) close(fd); - /* XXX: need to handle .tgz also */ - execl("/usr/bin/tar", "tar", Verbose ? "-xjvf" : "-xjf", "-", - (char *)0); + execl("/usr/bin/tar", "tar", +#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039 + Verbose ? "-xjvf" : "-xjf", +#else + Verbose ? "-xzvf" : "-xzf", +#endif + "-", (char *)0); _exit(2); } close(pfd[0]); diff --git a/usr.sbin/pkg_install/sign/Makefile b/usr.sbin/pkg_install/sign/Makefile index a6ad81a..7355535 100644 --- a/usr.sbin/pkg_install/sign/Makefile +++ b/usr.sbin/pkg_install/sign/Makefile @@ -9,8 +9,6 @@ SRCS= main.c check.c common.c gzip.c pgp_check.c pgp_sign.c \ CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib -WARNS?= 0 - DISTRIBUTION= crypto DPADD= ${LIBINSTALL} ${LIBMD} ${LIBCRYPTO} LDADD= ${LIBINSTALL} -lmd -lcrypto diff --git a/usr.sbin/pkg_install/sign/pgp_sign.c b/usr.sbin/pkg_install/sign/pgp_sign.c index cb7d186..78992ff 100644 --- a/usr.sbin/pkg_install/sign/pgp_sign.c +++ b/usr.sbin/pkg_install/sign/pgp_sign.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <stdio.h> #include <errno.h> diff --git a/usr.sbin/pkg_install/sign/sha1.c b/usr.sbin/pkg_install/sign/sha1.c index af0e6a9..272ae31 100644 --- a/usr.sbin/pkg_install/sign/sha1.c +++ b/usr.sbin/pkg_install/sign/sha1.c @@ -170,7 +170,6 @@ retrieve_sha1_marker(filename, sign, userid) char result[BUFSIZE]; ssize_t length = -1; struct sha1_checker *checker; - struct signature *old; *sign = NULL; if (userid == NULL) diff --git a/usr.sbin/pkg_install/sign/sign.c b/usr.sbin/pkg_install/sign/sign.c index 412b916..073ffff 100644 --- a/usr.sbin/pkg_install/sign/sign.c +++ b/usr.sbin/pkg_install/sign/sign.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <stdio.h> #include <errno.h> diff --git a/usr.sbin/pkg_install/sign/stand.h b/usr.sbin/pkg_install/sign/stand.h index bc8de2f..dbc3d69 100644 --- a/usr.sbin/pkg_install/sign/stand.h +++ b/usr.sbin/pkg_install/sign/stand.h @@ -18,10 +18,10 @@ #if defined(BSD4_4) #include <err.h> #else -extern void set_program_name __P((const char * name)); extern void warn __P((const char *fmt, ...)); extern void warnx __P((const char *fmt, ...)); #endif +extern void set_program_name __P((const char * name)); #ifndef __GNUC__ #define __attribute__(x) diff --git a/usr.sbin/pkg_install/sign/x509.c b/usr.sbin/pkg_install/sign/x509.c index 837a81e..3fd3b3e 100644 --- a/usr.sbin/pkg_install/sign/x509.c +++ b/usr.sbin/pkg_install/sign/x509.c @@ -89,7 +89,6 @@ new_x509_checker(h, sign, userid, envp, filename) FILE * fp; struct x509_checker * me; char certfile[PATH_MAX + 1] = CERTFILE; - char * cp; X509 * x509; assert(sign->type == TAG_X509); @@ -139,7 +138,7 @@ new_x509_checker(h, sign, userid, envp, filename) if (verbose) printf("Loading certificates from %s:\n", certfile); - while (x509 = PEM_read_X509(fp, NULL, NULL, 0)) { + while ((x509 = PEM_read_X509(fp, NULL, NULL, 0))) { sk_X509_push(me->certs, x509); switch (EVP_PKEY_type(X509_get_pubkey(x509)->type)) @@ -287,7 +286,6 @@ retrieve_x509_marker(filename, sign, userid) EVP_PKEY * pkey; char keyfile[PATH_MAX + 1] = KEYFILE; - char * kp; key_from_name(keyfile, userkey); diff --git a/usr.sbin/pkg_install/version/Makefile b/usr.sbin/pkg_install/version/Makefile index b097a3a..23ccf39 100644 --- a/usr.sbin/pkg_install/version/Makefile +++ b/usr.sbin/pkg_install/version/Makefile @@ -5,7 +5,8 @@ SRCS= main.c perform.c CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib -WARNS?= 2 +WARNS?= 6 +WFORMAT?= 1 DPADD= ${LIBINSTALL} ${LIBFETCH} ${LIBMD} LDADD= ${LIBINSTALL} -lfetch -lmd diff --git a/usr.sbin/pkg_install/version/perform.c b/usr.sbin/pkg_install/version/perform.c index 837dae2..c1e952d 100644 --- a/usr.sbin/pkg_install/version/perform.c +++ b/usr.sbin/pkg_install/version/perform.c @@ -52,10 +52,9 @@ pkg_perform(char **indexarg) /* * Try to find and open the INDEX. We only check IndexFile != NULL * later, if we actually need the INDEX. - * XXX This should not be hard-coded to INDEX-5. */ if (*indexarg == NULL) - snprintf(tmp, PATH_MAX, "%s/INDEX-5", PORTS_DIR); + snprintf(tmp, PATH_MAX, "%s/%s", PORTS_DIR, INDEX_FNAME); else strlcpy(tmp, *indexarg, PATH_MAX); if (isURL(tmp)) @@ -151,7 +150,7 @@ pkg_do(char *pkg) if (plist.origin != NULL) { snprintf(tmp, PATH_MAX, "%s/%s", PORTS_DIR, plist.origin); if (isdir(tmp) && chdir(tmp) != FAIL && isfile("Makefile")) { - if ((latest = vpipe("make -V PKGNAME", tmp)) == NULL) + if ((latest = vpipe("/usr/bin/make -V PKGNAME", tmp)) == NULL) warnx("Failed to get PKGNAME from %s/Makefile!", tmp); else show_version(plist.name, latest, "port"); |