summaryrefslogtreecommitdiff
path: root/install-sh
diff options
context:
space:
mode:
authorBalint Reczey <balint@balintreczey.hu>2021-11-07 15:18:49 +0100
committerBalint Reczey <balint@balintreczey.hu>2021-11-07 15:18:49 +0100
commit749c1780621163ca5108f164861324bafa9e0ae8 (patch)
tree51001872624a692018c45bf39276df94b603fb19 /install-sh
parentd906ecd3b652d95af6ffb974a2f6669501bb9496 (diff)
downloadshadow-749c1780621163ca5108f164861324bafa9e0ae8.tar.gz
New upstream version 4.9upstream/4.9
Diffstat (limited to 'install-sh')
-rwxr-xr-xinstall-sh36
1 files changed, 13 insertions, 23 deletions
diff --git a/install-sh b/install-sh
index 8175c640..59990a10 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2018-03-11.20; # UTC
+scriptversion=2014-09-12.12; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -271,18 +271,15 @@ do
fi
dst=$dst_arg
- # If destination is a directory, append the input filename.
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
- dstbase=`basename "$src"`
- case $dst in
- */) dst=$dst$dstbase;;
- *) dst=$dst/$dstbase;;
- esac
+ dst=$dstdir/`basename "$src"`
dstdir_status=0
else
dstdir=`dirname "$dst"`
@@ -291,11 +288,6 @@ do
fi
fi
- case $dstdir in
- */) dstdirslash=$dstdir;;
- *) dstdirslash=$dstdir/;;
- esac
-
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
@@ -332,16 +324,14 @@ do
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
- # Note that $RANDOM variable is not portable (e.g. dash); Use it
- # here however when possible just to lower collision chance.
+ # $RANDOM is not portable (e.g. dash); use it when possible to
+ # lower collision chance
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
- # Because "mkdir -p" follows existing symlinks and we likely work
- # directly in world-writeable /tmp, make sure that the '$tmpdir'
- # directory is successfully created first before we actually test
- # 'mkdir -p' feature.
+ # As "mkdir -p" follows symlinks and we work in /tmp possibly; so
+ # create the $tmpdir first (and fail if unsuccessful) to make sure
+ # that nobody tries to guess the $tmpdir name.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
@@ -444,8 +434,8 @@ do
else
# Make a couple of temp file names in the proper directory.
- dsttmp=${dstdirslash}_inst.$$_
- rmtmp=${dstdirslash}_rm.$$_
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
@@ -510,9 +500,9 @@ do
done
# Local variables:
-# eval: (add-hook 'before-save-hook 'time-stamp)
+# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC0"
+# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End: