diff options
| author | christos <christos@NetBSD.org> | 2002-10-17 03:31:33 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2002-10-17 03:31:33 +0000 |
| commit | 590fa669c8d8dee326e9540fdae461ef4c9d6f59 (patch) | |
| tree | fc5354671378d5829a709c25be360e28577e936a /usr.sbin/pkg_install/lib | |
| parent | fe9dc5bbfc2256202a8a237372215c5b9008bebe (diff) | |
- eliminate the hard-coding of pathnames in the default install.
- all command executions now use the path [execvp/execlp/system].
- normalize the macro names as <COMMAND>_CMD.
- in some OS's full pathnames for commands can still be provided, but this
is not the default.
This was needed to fix -DTAR_FULLPATHNAME="/usr/bin/tar"
Diffstat (limited to 'usr.sbin/pkg_install/lib')
| -rw-r--r-- | usr.sbin/pkg_install/lib/file.c | 6 | ||||
| -rw-r--r-- | usr.sbin/pkg_install/lib/ftpio.c | 15 | ||||
| -rw-r--r-- | usr.sbin/pkg_install/lib/lib.h | 20 |
3 files changed, 24 insertions, 17 deletions
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index 37acb2a30ee..55c42af7e98 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -1,11 +1,11 @@ -/* $NetBSD: file.c,v 1.55 2002/07/20 08:40:19 grant Exp $ */ +/* $NetBSD: file.c,v 1.56 2002/10/17 03:31:34 christos Exp $ */ #include <sys/cdefs.h> #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp"; #else -__RCSID("$NetBSD: file.c,v 1.55 2002/07/20 08:40:19 grant Exp $"); +__RCSID("$NetBSD: file.c,v 1.56 2002/10/17 03:31:34 christos Exp $"); #endif #endif @@ -542,7 +542,7 @@ unpack(const char *pkg, const char *flist) } else strcat(args, "z"); strcat(args, "xpf"); - if (vsystem("%s %s %s %s", TAR_FULLPATHNAME, args, pkg, flist ? flist : "")) { + if (vsystem("%s %s %s %s", TAR_CMD, args, pkg, flist ? flist : "")) { warnx("%s extract of %s failed!", TAR_CMD, pkg); return 1; } diff --git a/usr.sbin/pkg_install/lib/ftpio.c b/usr.sbin/pkg_install/lib/ftpio.c index d6339917dfd..dc16dac13fe 100644 --- a/usr.sbin/pkg_install/lib/ftpio.c +++ b/usr.sbin/pkg_install/lib/ftpio.c @@ -1,8 +1,8 @@ -/* $NetBSD: ftpio.c,v 1.42 2002/09/19 02:13:57 mycroft Exp $ */ +/* $NetBSD: ftpio.c,v 1.43 2002/10/17 03:31:35 christos Exp $ */ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: ftpio.c,v 1.42 2002/09/19 02:13:57 mycroft Exp $"); +__RCSID("$NetBSD: ftpio.c,v 1.43 2002/10/17 03:31:35 christos Exp $"); #endif /* @@ -255,6 +255,11 @@ setupCoproc(const char *base) int answer_pipe[2]; int rc1, rc2; char buf[20]; + char *argv0 = strrchr(FTP_CMD, '/'); + if (argv0 == NULL) + argv0 = FTP_CMD; + else + argv0++; rc1 = pipe(command_pipe); rc2 = pipe(answer_pipe); @@ -300,8 +305,8 @@ setupCoproc(const char *base) if (Verbose) fprintf(stderr, "[1mftp -detv %s[0m\n", base); - rc1 = execl(FTP_FULLPATHNAME, FTP_CMD, "-detv", base, NULL); - warn("setupCoproc: execl() failed"); + rc1 = execlp(FTP_CMD, argv0, "-detv", base, NULL); + warn("setupCoproc: execlp() failed"); exit(1); break; default: @@ -689,7 +694,7 @@ unpackURL(const char *url, const char *dir) printf("unpackURL '%s' to '%s'\n", url, dir); /* yes, this is gross, but needed for borken ftp(1) */ - (void) snprintf(cmd, sizeof(cmd), "get %s \"| ( cd %s ; gunzip 2>/dev/null | " TAR_FULLPATHNAME " -%sx -f - | tee /dev/stderr )\"\n", pkg, dir, Verbose?"vv":""); + (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":""); rc = ftp_cmd(cmd, "\n(226|550).*\n"); if (rc != 226) { warnx("Cannot fetch file (%d!=226)!", rc); diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 2f13835134a..a06e533b133 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -1,4 +1,4 @@ -/* $NetBSD: lib.h,v 1.43 2002/07/19 19:04:40 yamt Exp $ */ +/* $NetBSD: lib.h,v 1.44 2002/10/17 03:31:35 christos Exp $ */ /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */ @@ -63,19 +63,21 @@ #define TAR_CMD "tar" #endif -/* Full path name of TAR_CMD */ -#ifndef TAR_FULLPATHNAME -#define TAR_FULLPATHNAME "/usr/bin/tar" -#endif - /* Define ftp as a string, in case the ftp client is called something else */ #ifndef FTP_CMD #define FTP_CMD "ftp" #endif -/* Full path name of FTP_CMD */ -#ifndef FTP_FULLPATHNAME -#define FTP_FULLPATHNAME "/usr/bin/ftp" +#ifndef CHOWN_CMD +#define CHOWN_CMD "chown" +#endif + +#ifndef CHMOD_CMD +#define CHMOD_CMD "chmod" +#endif + +#ifndef CHGRP_CMD +#define CHGRP_CMD "chgrp" #endif /* Where we put logging information by default, else ${PKG_DBDIR} if set */ |
