~ubuntu-branches/ubuntu/trusty/389-ds-base/trusty

« back to all changes in this revision

Viewing changes to install-sh

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2013-08-30 00:31:55 UTC
  • mfrom: (1.2.1)
  • Revision ID: package-import@ubuntu.com-20130830003155-oimuzdqopkvp2cd0
Tags: 1.3.1.7-0ubuntu1
Sync from unreleased debian git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
# install - install a program, script, or datafile
3
3
 
4
 
scriptversion=2009-04-28.21; # UTC
 
4
scriptversion=2011-11-20.07; # UTC
5
5
 
6
6
# This originates from X11R5 (mit/util/scripts/install.sh), which was
7
7
# later released in X11R6 (xc/config/util/install.sh) with the
35
35
# FSF changes to this file are in the public domain.
36
36
#
37
37
# Calling this script install-sh is preferred over install.sh, to prevent
38
 
# `make' implicit rules from creating a file called install from it
 
38
# 'make' implicit rules from creating a file called install from it
39
39
# when there is no Makefile.
40
40
#
41
41
# This script is compatible with the BSD install script, but was written
156
156
    -s) stripcmd=$stripprog;;
157
157
 
158
158
    -t) dst_arg=$2
 
159
        # Protect names problematic for 'test' and other utilities.
 
160
        case $dst_arg in
 
161
          -* | [=\(\)!]) dst_arg=./$dst_arg;;
 
162
        esac
159
163
        shift;;
160
164
 
161
165
    -T) no_target_directory=true;;
186
190
    fi
187
191
    shift # arg
188
192
    dst_arg=$arg
 
193
    # Protect names problematic for 'test' and other utilities.
 
194
    case $dst_arg in
 
195
      -* | [=\(\)!]) dst_arg=./$dst_arg;;
 
196
    esac
189
197
  done
190
198
fi
191
199
 
194
202
    echo "$0: no input file specified." >&2
195
203
    exit 1
196
204
  fi
197
 
  # It's OK to call `install-sh -d' without argument.
 
205
  # It's OK to call 'install-sh -d' without argument.
198
206
  # This can happen when creating conditional directories.
199
207
  exit 0
200
208
fi
201
209
 
202
210
if test -z "$dir_arg"; then
203
 
  trap '(exit $?); exit' 1 2 13 15
 
211
  do_exit='(exit $ret); exit $ret'
 
212
  trap "ret=129; $do_exit" 1
 
213
  trap "ret=130; $do_exit" 2
 
214
  trap "ret=141; $do_exit" 13
 
215
  trap "ret=143; $do_exit" 15
204
216
 
205
217
  # Set umask so as not to create temps with too-generous modes.
206
218
  # However, 'strip' requires both read and write access to temps.
228
240
 
229
241
for src
230
242
do
231
 
  # Protect names starting with `-'.
 
243
  # Protect names problematic for 'test' and other utilities.
232
244
  case $src in
233
 
    -*) src=./$src;;
 
245
    -* | [=\(\)!]) src=./$src;;
234
246
  esac
235
247
 
236
248
  if test -n "$dir_arg"; then
252
264
      echo "$0: no destination specified." >&2
253
265
      exit 1
254
266
    fi
255
 
 
256
267
    dst=$dst_arg
257
 
    # Protect names starting with `-'.
258
 
    case $dst in
259
 
      -*) dst=./$dst;;
260
 
    esac
261
268
 
262
269
    # If destination is a directory, append the input filename; won't work
263
270
    # if double slashes aren't ignored.
347
354
              if test -z "$dir_arg" || {
348
355
                   # Check for POSIX incompatibilities with -m.
349
356
                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
350
 
                   # other-writeable bit of parent directory when it shouldn't.
 
357
                   # other-writable bit of parent directory when it shouldn't.
351
358
                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
352
359
                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
353
360
                   case $ls_ld_tmpdir in
385
392
 
386
393
      case $dstdir in
387
394
        /*) prefix='/';;
388
 
        -*) prefix='./';;
 
395
        [-=\(\)!]*) prefix='./';;
389
396
        *)  prefix='';;
390
397
      esac
391
398
 
403
410
 
404
411
      for d
405
412
      do
406
 
        test -z "$d" && continue
 
413
        test X"$d" = X && continue
407
414
 
408
415
        prefix=$prefix$d
409
416
        if test -d "$prefix"; then