From 2d3a1701d37d8b3fbe426cf993ae4feb8be99c8e Mon Sep 17 00:00:00 2001 From: agc Date: Fri, 21 Jun 2002 14:49:40 +0000 Subject: [PATCH] Avoid hardcoding /usr/bin/ftp in the pkg_add binary. Fixes provided by Stoned Elipot in PR 17323 --- usr.sbin/pkg_install/Makefile.inc | 7 +++++-- usr.sbin/pkg_install/lib/ftpio.c | 6 +++--- usr.sbin/pkg_install/lib/lib.h | 12 +++++++++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/usr.sbin/pkg_install/Makefile.inc b/usr.sbin/pkg_install/Makefile.inc index bf2439046129..475b00314d75 100644 --- a/usr.sbin/pkg_install/Makefile.inc +++ b/usr.sbin/pkg_install/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.17 2002/06/10 09:14:26 yamt Exp $ +# $NetBSD: Makefile.inc,v 1.18 2002/06/21 14:49:40 agc Exp $ # Original from FreeBSD, no rcs id. .include @@ -22,11 +22,14 @@ CHOWN?= /usr/sbin/chown CHGRP?= /usr/bin/chgrp WARNS=2 .elif ${OPSYS} == "SunOS" -LOCALBASE?= /usr/local +LOCALBASE?= /usr/pkg TAR_CMD?= tar +FTP_CMD?= tar ZOULARISBASE?= ${LOCALBASE}/bsd TAR_FULLPATHNAME?= ${ZOULARISBASE}/bin/${TAR_CMD} +FTP_FULLPATHNAME?= ${ZOULARISBASE}/bin/${FTP_CMD} CPPFLAGS+=-DTAR_CMD='"${TAR_CMD}"' -DTAR_FULLPATHNAME='"${TAR_FULLPATHNAME}"' +CPPFLAGS+=-DFTP_CMD='"${FTP_CMD}"' -DFTP_FULLPATHNAME='"${FTP_FULLPATHNAME}"' BINDIR=${ZOULARISBASE}/bin CHMOD?= /usr/bin/chmod CHOWN?= /usr/bin/chown diff --git a/usr.sbin/pkg_install/lib/ftpio.c b/usr.sbin/pkg_install/lib/ftpio.c index 7af63990e30b..ab12ea9a871d 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.37 2002/06/10 09:14:28 yamt Exp $ */ +/* $NetBSD: ftpio.c,v 1.38 2002/06/21 14:49:41 agc Exp $ */ #include #ifndef lint -__RCSID("$NetBSD: ftpio.c,v 1.37 2002/06/10 09:14:28 yamt Exp $"); +__RCSID("$NetBSD: ftpio.c,v 1.38 2002/06/21 14:49:41 agc Exp $"); #endif /* @@ -297,7 +297,7 @@ setupCoproc(const char *base) if (Verbose) fprintf(stderr, "ftp -detv %s\n", base); - rc1 = execl("/usr/bin/ftp", "ftp", "-detv", base, NULL); + rc1 = execl(FTP_FULLPATHNAME, FTP_CMD, "-detv", base, NULL); warn("setupCoproc: execl() failed"); exit(1); break; diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 05b19f7636ff..b16cd3e7bfa2 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.41 2002/06/10 09:14:28 yamt Exp $ */ +/* $NetBSD: lib.h,v 1.42 2002/06/21 14:49:41 agc Exp $ */ /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */ @@ -66,6 +66,16 @@ #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" +#endif + /* Where we put logging information by default, else ${PKG_DBDIR} if set */ #ifndef DEF_LOG_DIR #define DEF_LOG_DIR "/var/db/pkg"