summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-09-05 13:37:46 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-09-05 13:37:46 (GMT)
commitefb3134805b2c8c19804635b58a4c84e8de57a35 (patch)
treee4f1a642675abf58a8e7b15fa575b48f815eb262
parenta1f009072721df777e34fe4d81b72f2d20d35223 (diff)
downloadtcl-efb3134805b2c8c19804635b58a4c84e8de57a35.zip
tcl-efb3134805b2c8c19804635b58a4c84e8de57a35.tar.gz
tcl-efb3134805b2c8c19804635b58a4c84e8de57a35.tar.bz2
Fix [d3465c9188]: Update install-sh to version "2020-11-14.01; # UTC"
tweak: our own -S modification renamed to -R, resolving a conflict
-rw-r--r--unix/Makefile.in2
-rwxr-xr-xunix/install-sh41
2 files changed, 35 insertions, 8 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 21d4085..c1e6e83 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -151,7 +151,7 @@ SHELL = @MAKEFILE_SHELL@
# distribution, which is slower but guaranteed to work.
INSTALL_STRIP_PROGRAM = -s
-INSTALL_STRIP_LIBRARY = -S -x
+INSTALL_STRIP_LIBRARY = -R -x
INSTALL = $(SHELL) $(UNIX_DIR)/install-sh -c
INSTALL_PROGRAM = ${INSTALL}
diff --git a/unix/install-sh b/unix/install-sh
index b6593f3..093e5ea 100755
--- a/unix/install-sh
+++ b/unix/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2020-07-26.22; # UTC
+scriptversion=2020-11-14.01; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -73,6 +73,7 @@ mode=0755
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
+backupsuffix=
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
@@ -103,19 +104,29 @@ Options:
--version display version info and exit.
-c (ignored)
- -C install only if different (preserve the last data modification time)
+ -C install only if different (preserve data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
+ -p pass -p to $cpprog.
+ -R OPTION $stripprog installed files using OPTION.
-s $stripprog installed files.
- -S OPTION $stripprog installed files using OPTION.
+ -S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
+
+By default, rm is invoked with -f; when overridden with RMPROG,
+it's up to you to specify -f if you want it.
+
+If -S is not specified, no backups are attempted.
+
+Email bug reports to bug-automake@gnu.org.
+Automake home page: https://www.gnu.org/software/automake/
"
while test $# -ne 0; do
@@ -142,9 +153,14 @@ while test $# -ne 0; do
-o) chowncmd="$chownprog $2"
shift;;
+ -p) cpprog="$cpprog -p";;
+
+ -R) stripcmd="$stripprog $2"
+ shift;;
+
-s) stripcmd=$stripprog;;
- -S) stripcmd="$stripprog $2"
+ -S) backupsuffix="$2"
shift;;
-t)
@@ -263,6 +279,10 @@ do
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
+ # Don't chown directories that already exist.
+ if test $dstdir_status = 0; then
+ chowncmd=""
+ fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@@ -329,7 +349,7 @@ do
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
- # directly in world-writable /tmp, make sure that the '$tmpdir'
+ # directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
@@ -477,6 +497,13 @@ do
then
rm -f "$dsttmp"
else
+ # If $backupsuffix is set, and the file being installed
+ # already exists, attempt a backup. Don't worry if it fails,
+ # e.g., if mv doesn't support -f.
+ if test -n "$backupsuffix" && test -f "$dst"; then
+ $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
+ fi
+
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
@@ -491,9 +518,9 @@ do
# file should still install successfully.
{
test ! -f "$dst" ||
- $doit $rmcmd -f "$dst" 2>/dev/null ||
+ $doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1