Annotation of researchv10no/cmd/uucp/unused/Install, revision 1.1.1.1

1.1       root        1: #!/bin/sh
                      2: # This shell simulates the action of the install command that
                      3: # is available on system V systems.
                      4: #  It only does the part required for my makefile!
                      5: #
                      6: USAGE="usage: Install -f Directory [-o] [-m mode] [-u owner] [-g group] File"
                      7: #
                      8: # It will copy file to Directory changes the mode, owner and
                      9: # group if specified.  If -o is used, an existing file is moved
                     10: # to OLDfile.
                     11: 
                     12: OLD=
                     13: MODE=
                     14: OWNER=
                     15: GROUP=
                     16: FILE=
                     17: 
                     18: while [ $# -gt 0 ]
                     19: do
                     20:        case $1 in
                     21:        -o)     OLD="OLD"
                     22:                shift
                     23:                ;;
                     24: 
                     25:        -f)     shift
                     26:                DIR=$1
                     27:                shift
                     28:                ;;
                     29: 
                     30:        -f*)    DIR=`echo $1|sed "s/..//"`
                     31:                shift
                     32:                ;;
                     33: 
                     34:        -m)     shift
                     35:                MODE=$1
                     36:                shift
                     37:                ;;
                     38: 
                     39:        -m*)    MODE=`echo $1|sed "s/..//"`
                     40:                shift
                     41:                ;;
                     42: 
                     43:        -u)     shift
                     44:                OWNER=$1
                     45:                shift
                     46:                ;;
                     47: 
                     48:        -u*)    OWNER=`echo $1|sed "s/..//"`
                     49:                shift
                     50:                ;;
                     51: 
                     52:        -g)     shift
                     53:                GROUP=$1
                     54:                shift
                     55:                ;;
                     56: 
                     57:        -g*)    GROUP=`echo $1|sed "s/..//"`
                     58:                shift
                     59:                ;;
                     60: 
                     61:        *)      FILE=$1
                     62:                break
                     63:                ;;
                     64: 
                     65:        esac
                     66: done
                     67: 
                     68: 
                     69: if [ -z "$FILE" -o -z "$DIR" ]; then
                     70:        echo $USAGE
                     71:        exit 1
                     72: fi
                     73: 
                     74: if [ -n "$OLD" ]; then
                     75:        echo mv $DIR/$FILE $DIR/OLD$FILE
                     76:        mv $DIR/$FILE $DIR/OLD$FILE
                     77: fi
                     78: 
                     79: rm -f $DIR/$FILE
                     80: echo cp $FILE $DIR/$FILE
                     81: cp $FILE $DIR/$FILE
                     82: 
                     83: if [ -n "$GROUP" ]; then
                     84:        echo chgrp $GROUP $DIR/$FILE
                     85:        chgrp $GROUP $DIR/$FILE
                     86: fi
                     87: 
                     88: if [ -n "$MODE" ]; then
                     89:        echo chmod $MODE $DIR/$FILE
                     90:        chmod $MODE $DIR/$FILE
                     91: fi
                     92: 
                     93: 
                     94: if [ -n "$OWNER" ]; then
                     95:        echo chown $OWNER $DIR/$FILE
                     96:        chown $OWNER $DIR/$FILE
                     97: fi
                     98: 
                     99: ls -l $DIR/$FILE

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.