source: trunk/third/top/install @ 9084

Revision 9084, 928 bytes checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r9083, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2#
3# this shell script is amazingly similar to the old and lamented
4# BSD "install" command.  It recognized the following options:
5#
6#       -o target file owner
7#       -m target file mode
8#       -g target file group owner
9#
10#
11# scan the options
12#
13while [ $# -gt 0 ]; do
14    case $1 in
15      -o)
16        owner=$2
17        shift ; shift
18        ;;
19
20      -m)
21        mode=$2
22        shift; shift
23        ;;
24
25      -g)
26        group=$2
27        shift ; shift
28        ;;
29
30      -*)
31        echo "install: unknown option $1"
32        exit
33        ;;
34
35      *)
36        break
37        ;;
38    esac
39done
40#
41# we need two more:  filename and destination
42#
43if [ $# -ne 2 ]; then
44    echo "Usage:  install [ -o owner ] [ -m mode ] [ -g group ] file destination"
45    exit
46fi
47#
48# first, copy
49#
50cp $1 $2
51#
52# normalize the name
53#
54dest=$2
55if [ -d $2 ]; then
56    dest=$2/`basename $1`
57fi
58#
59# do optional things
60#
61if [ "$owner" ]; then
62    chown $owner $dest
63fi
64if [ "$group" ]; then
65    chgrp $group $dest
66fi
67if [ "$mode" ]; then
68    chmod $mode $dest
69fi
Note: See TracBrowser for help on using the repository browser.