annotate install-sh @ 189:7c552cbc6ad9

srogue: make checking directories slightly more portable. MSVC sys/stat.h doesn't define S_ISDIR().
author John "Elwin" Edwards
date Mon, 03 Aug 2015 09:05:15 -0400
parents 78ca6502d2a6
children d9badb9c0179
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
1 #!/bin/sh
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
2 # install - install a program, script, or datafile
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
3
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
4 scriptversion=2011-11-20.07; # UTC
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
5
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
6 # This originates from X11R5 (mit/util/scripts/install.sh), which was
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
7 # later released in X11R6 (xc/config/util/install.sh) with the
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
8 # following copyright and license.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
9 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
10 # Copyright (C) 1994 X Consortium
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
11 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
12 # Permission is hereby granted, free of charge, to any person obtaining a copy
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
13 # of this software and associated documentation files (the "Software"), to
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
14 # deal in the Software without restriction, including without limitation the
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
15 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
16 # sell copies of the Software, and to permit persons to whom the Software is
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
17 # furnished to do so, subject to the following conditions:
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
18 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
19 # The above copyright notice and this permission notice shall be included in
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
20 # all copies or substantial portions of the Software.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
21 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
23 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
24 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
25 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
26 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
27 # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
28 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
29 # Except as contained in this notice, the name of the X Consortium shall not
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
30 # be used in advertising or otherwise to promote the sale, use or other deal-
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
31 # ings in this Software without prior written authorization from the X Consor-
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
32 # tium.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
33 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
34 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
35 # FSF changes to this file are in the public domain.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
36 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
37 # Calling this script install-sh is preferred over install.sh, to prevent
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
38 # 'make' implicit rules from creating a file called install from it
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
39 # when there is no Makefile.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
40 #
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
41 # This script is compatible with the BSD install script, but was written
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
42 # from scratch.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
43
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
44 nl='
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
45 '
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
46 IFS=" "" $nl"
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
47
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
48 # set DOITPROG to echo to test this script
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
49
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
50 # Don't use :- since 4.3BSD and earlier shells don't like it.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
51 doit=${DOITPROG-}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
52 if test -z "$doit"; then
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
53 doit_exec=exec
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
54 else
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
55 doit_exec=$doit
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
56 fi
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
57
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
58 # Put in absolute file names if you don't have them in your path;
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
59 # or use environment vars.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
60
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
61 chgrpprog=${CHGRPPROG-chgrp}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
62 chmodprog=${CHMODPROG-chmod}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
63 chownprog=${CHOWNPROG-chown}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
64 cmpprog=${CMPPROG-cmp}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
65 cpprog=${CPPROG-cp}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
66 mkdirprog=${MKDIRPROG-mkdir}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
67 mvprog=${MVPROG-mv}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
68 rmprog=${RMPROG-rm}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
69 stripprog=${STRIPPROG-strip}
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
70
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
71 posix_glob='?'
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
72 initialize_posix_glob='
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
73 test "$posix_glob" != "?" || {
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
74 if (set -f) 2>/dev/null; then
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
75 posix_glob=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
76 else
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
77 posix_glob=:
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
78 fi
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
79 }
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
80 '
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
81
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
82 posix_mkdir=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
83
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
84 # Desired mode of installed file.
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
85 mode=0755
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
86
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
87 chgrpcmd=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
88 chmodcmd=$chmodprog
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
89 chowncmd=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
90 mvcmd=$mvprog
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
91 rmcmd="$rmprog -f"
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
92 stripcmd=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
93
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
94 src=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
95 dst=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
96 dir_arg=
07c4d4883ef2 rogue3: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
97 dst_arg=