6179 Want various ISO8859-1 locales
[unleashed.git] / usr / src / cmd / bnu / Install
blob8d0f75c991c3ab9a0196314e60aba12acaf70db9
1 #!/usr/bin/sh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
8 # with the License.
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
21 # CDDL HEADER END
23 #ident "%Z%%M% %I% %E% SMI" /* from SVR4 bnu:Install 2.3 */
25 # This shell simulates the action of the install command that
26 # is available on system V systems.
27 # It only does the part required for my makefile!
29 USAGE="usage: Install -f Directory [-o] [-m mode] [-u owner] [-g group] File"
31 # It will copy file to Directory changes the mode, owner and
32 # group if specified. If -o is used, an existing file is moved
33 # to OLDfile.
35 OLD=
36 MODE=
37 OWNER=
38 GROUP=
39 FILE=
41 while [ $# -gt 0 ]
43 case $1 in
44 -o) OLD="OLD"
45 shift
48 -f) shift
49 DIR=$1
50 shift
53 -f*) DIR=`echo $1|sed "s/..//"`
54 shift
57 -m) shift
58 MODE=$1
59 shift
62 -m*) MODE=`echo $1|sed "s/..//"`
63 shift
66 -u) shift
67 OWNER=$1
68 shift
71 -u*) OWNER=`echo $1|sed "s/..//"`
72 shift
75 -g) shift
76 GROUP=$1
77 shift
80 -g*) GROUP=`echo $1|sed "s/..//"`
81 shift
84 *) FILE=$1
85 break
88 esac
89 done
92 if [ -z "$FILE" -o -z "$DIR" ]; then
93 echo $USAGE
94 exit 1
97 if [ -n "$OLD" ]; then
98 echo mv $DIR/$FILE $DIR/OLD$FILE
99 mv $DIR/$FILE $DIR/OLD$FILE
102 rm -f $DIR/$FILE
103 echo cp $FILE $DIR/$FILE
104 cp $FILE $DIR/$FILE
106 if [ -n "$GROUP" ]; then
107 echo chgrp $GROUP $DIR/$FILE
108 chgrp $GROUP $DIR/$FILE
111 if [ -n "$MODE" ]; then
112 echo chmod $MODE $DIR/$FILE
113 chmod $MODE $DIR/$FILE
117 if [ -n "$OWNER" ]; then
118 echo chown $OWNER $DIR/$FILE
119 chown $OWNER $DIR/$FILE
122 ls -l $DIR/$FILE