Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/unix/install-sh @ 52

Last change on this file since 52 was 25, checked in by landauf, 17 years ago

added tcl to libs

File size: 2.2 KB
Line 
1#!/bin/sh
2
3#
4# install - install a program, script, or datafile
5# This comes from X11R5; it is not part of GNU.
6#
7# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
8#
9# This script is compatible with the BSD install script, but was written
10# from scratch.
11#
12
13
14# set DOITPROG to echo to test this script
15
16# Don't use :- since 4.3BSD and earlier shells don't like it.
17doit="${DOITPROG-}"
18
19
20# put in absolute paths if you don't have them in your path; or use env. vars.
21
22mvprog="${MVPROG-mv}"
23cpprog="${CPPROG-cp}"
24chmodprog="${CHMODPROG-chmod}"
25chownprog="${CHOWNPROG-chown}"
26chgrpprog="${CHGRPPROG-chgrp}"
27stripprog="${STRIPPROG-strip}"
28rmprog="${RMPROG-rm}"
29
30instcmd="$mvprog"
31chmodcmd=""
32chowncmd=""
33chgrpcmd=""
34stripcmd=""
35rmcmd="$rmprog -f"
36mvcmd="$mvprog"
37src=""
38dst=""
39
40while [ x"$1" != x ]; do
41    case $1 in
42        -c) instcmd="$cpprog"
43            shift
44            continue;;
45
46        -m) chmodcmd="$chmodprog $2"
47            shift
48            shift
49            continue;;
50
51        -o) chowncmd="$chownprog $2"
52            shift
53            shift
54            continue;;
55
56        -g) chgrpcmd="$chgrpprog $2"
57            shift
58            shift
59            continue;;
60
61        -s) stripcmd="$stripprog"
62            shift
63            continue;;
64
65        -S) stripcmd="$stripprog $2"
66            shift
67            shift
68            continue;;
69
70        *)  if [ x"$src" = x ]
71            then
72                src=$1
73            else
74                dst=$1
75            fi
76            shift
77            continue;;
78    esac
79done
80
81if [ x"$src" = x ]
82then
83        echo "install:  no input file specified"
84        exit 1
85fi
86
87if [ x"$dst" = x ]
88then
89        echo "install:  no destination specified"
90        exit 1
91fi
92
93
94# If destination is a directory, append the input filename; if your system
95# does not like double slashes in filenames, you may need to add some logic
96
97if [ -d "$dst" ]
98then
99        dst="$dst/`basename "$src"`"
100fi
101
102# Make a temp file name in the proper directory.
103
104dstdir="`dirname "$dst"`"
105dsttmp="$dstdir"/#inst.$$#
106
107# Move or copy the file name to the temp name
108
109$doit $instcmd "$src" "$dsttmp"
110
111# and set any options; do chmod last to preserve setuid bits
112
113if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; fi
114if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; fi
115if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; fi
116if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; fi
117
118# Now rename the file to the real destination.
119
120$doit $rmcmd "$dst"
121$doit $mvcmd "$dsttmp" "$dst"
122
123
124exit 0
Note: See TracBrowser for help on using the repository browser.