/* If true, install a directory instead of a regular file. */
static bool dir_arg;
+/* Program used to strip binaries, "strip" is default */
+static char *strip_program = "strip";
+
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
- PRESERVE_CONTEXT_OPTION = CHAR_MAX + 1
+ PRESERVE_CONTEXT_OPTION = CHAR_MAX + 1,
+ STRIP_PROGRAM_OPTION
};
static struct option const long_options[] =
a year or two later. */
{"preserve_context", no_argument, NULL, PRESERVE_CONTEXT_OPTION},
{"strip", no_argument, NULL, 's'},
+ {"strip-program", required_argument, NULL, STRIP_PROGRAM_OPTION},
{"suffix", required_argument, NULL, 'S'},
{"target-directory", required_argument, NULL, 't'},
{"verbose", no_argument, NULL, 'v'},
bool no_target_directory = false;
int n_files;
char **file;
+ bool strip_program_specified = false;
security_context_t scontext = NULL;
/* set iff kernel has extra selinux system calls */
selinux_enabled = (0 < is_selinux_enabled ());
signal (SIGCHLD, SIG_DFL);
#endif
break;
+ case STRIP_PROGRAM_OPTION:
+ strip_program = xstrdup (optarg);
+ strip_program_specified = true;
+ break;
case 'd':
dir_arg = true;
break;
free (change);
}
+ if (strip_program_specified && !strip_files)
+ error (0, 0, _("WARNING: ignoring --strip-program option as -s option was "
+ "not specified"));
+
get_ids ();
if (dir_arg)
error (EXIT_FAILURE, errno, _("fork system call failed"));
break;
case 0: /* Child. */
- execlp ("strip", "strip", name, NULL);
- error (EXIT_FAILURE, errno, _("cannot run strip"));
+ execlp (strip_program, strip_program, name, NULL);
+ error (EXIT_FAILURE, errno, _("cannot run %s"), strip_program);
break;
default: /* Parent. */
if (waitpid (pid, &status, 0) < 0)
-p, --preserve-timestamps apply access/modification times of SOURCE files\n\
to corresponding destination files\n\
-s, --strip strip symbol tables\n\
+ --strip-program=PROGRAM program used to strip binaries\n\
-S, --suffix=SUFFIX override the usual backup suffix\n\
-t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY\n\
-T, --no-target-directory treat DEST as a normal file\n\
--- /dev/null
+#!/bin/sh
+# Ensure "install -s --strip-program=PROGRAM" uses the program to strip
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ ginstall --version
+fi
+
+. $srcdir/test-lib.sh
+
+working_umask_or_skip_
+
+cat <<EOF > b || framework_failure
+#!$POSIX_SHELL
+sed s/b/B/ \$1 > \$1.t && mv \$1.t \$1
+EOF
+chmod a+x b || framework_failure
+
+fail=0
+
+echo abc > src || fail=1
+echo aBc > exp || fail=1
+ginstall src dest -s --strip-program=./b || fail=1
+compare dest exp || fail=1
+
+(exit $fail); exit $fail