summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-04-17 19:13:59 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-04-17 19:13:59 +0000
commite8c24a34e8d5b58a56602041fd2fc405757d77c8 (patch)
tree681d1b1ed70c9e3bb1a403ce12b0c8e7b9015f7c /usr.bin
parentab2e5ab11a81ae2b4efe76e1181156baf73460b2 (diff)
Add support for STRIP environment variable to specify where strip(1)
lives. Idea from NetBSD.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/xinstall/install.117
-rw-r--r--usr.bin/xinstall/xinstall.c12
2 files changed, 22 insertions, 7 deletions
diff --git a/usr.bin/xinstall/install.1 b/usr.bin/xinstall/install.1
index ff056abc606..38aaf1f11ed 100644
--- a/usr.bin/xinstall/install.1
+++ b/usr.bin/xinstall/install.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: install.1,v 1.4 1996/08/08 20:49:27 millert Exp $
+.\" $OpenBSD: install.1,v 1.5 1997/04/17 19:13:55 millert Exp $
.\" $NetBSD: install.1,v 1.4 1994/11/14 04:57:17 jtc Exp $
.\"
.\" Copyright (c) 1987, 1990, 1993
@@ -121,9 +121,11 @@ rename fails, the existing target is left untouched.
.It Fl s
.Nm Install
exec's the command
-.Xr strip 1
+.Pa /usr/bin/strip
to strip binaries so that install can be portable over a large
-number of systems and binary types.
+number of systems and binary types. If the environment variable
+.Ev STRIP
+is set, it is used instead.
.El
.Pp
By default,
@@ -155,6 +157,15 @@ option, temporary files named INS@XXXXXX,
where XXXXXX is decided by
.Xr mkstemp 3 ,
are created in the target directory.
+.Sh ENVIRONMENT
+.Nm
+utilizes the following environment variables.
+.Bl -tag -width "STRIP"
+.It Ev STRIP
+For an alternate
+.Xr strip 1
+program to run. Default is
+.Pa /usr/bin/strip .
.Sh SEE ALSO
.Xr chflags 1 ,
.Xr chgrp 1 ,
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index 3d642627609..ed05f796eb0 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xinstall.c,v 1.12 1997/03/07 01:57:08 millert Exp $ */
+/* $OpenBSD: xinstall.c,v 1.13 1997/04/17 19:13:58 millert Exp $ */
/* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
#endif
-static char rcsid[] = "$OpenBSD: xinstall.c,v 1.12 1997/03/07 01:57:08 millert Exp $";
+static char rcsid[] = "$OpenBSD: xinstall.c,v 1.13 1997/04/17 19:13:58 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -509,6 +509,10 @@ strip(to_name)
char *to_name;
{
int serrno, status;
+ char *path_strip;
+
+ if (issetugid() || (path_strip = getenv("STRIP")) == NULL)
+ path_strip = _PATH_STRIP;
switch (vfork()) {
case -1:
@@ -516,8 +520,8 @@ strip(to_name)
(void)unlink(to_name);
errx(EX_TEMPFAIL, "forks: %s", strerror(serrno));
case 0:
- execl(_PATH_STRIP, "strip", to_name, NULL);
- warn("%s", _PATH_STRIP);
+ execl(path_strip, "strip", to_name, NULL);
+ warn("%s", path_strip);
_exit(EX_OSERR);
default:
if (wait(&status) == -1 || status)