1*7c478bd9Sstevel@tonic-gate#!/usr/bin/sh 2*7c478bd9Sstevel@tonic-gate# 3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START 4*7c478bd9Sstevel@tonic-gate# 5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 7*7c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 8*7c478bd9Sstevel@tonic-gate# with the License. 9*7c478bd9Sstevel@tonic-gate# 10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 13*7c478bd9Sstevel@tonic-gate# and limitations under the License. 14*7c478bd9Sstevel@tonic-gate# 15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 20*7c478bd9Sstevel@tonic-gate# 21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END 22*7c478bd9Sstevel@tonic-gate# 23*7c478bd9Sstevel@tonic-gate#ident "%Z%%M% %I% %E% SMI" /* from SVR4 bnu:Install 2.3 */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate# This shell simulates the action of the install command that 26*7c478bd9Sstevel@tonic-gate# is available on system V systems. 27*7c478bd9Sstevel@tonic-gate# It only does the part required for my makefile! 28*7c478bd9Sstevel@tonic-gate# 29*7c478bd9Sstevel@tonic-gateUSAGE="usage: Install -f Directory [-o] [-m mode] [-u owner] [-g group] File" 30*7c478bd9Sstevel@tonic-gate# 31*7c478bd9Sstevel@tonic-gate# It will copy file to Directory changes the mode, owner and 32*7c478bd9Sstevel@tonic-gate# group if specified. If -o is used, an existing file is moved 33*7c478bd9Sstevel@tonic-gate# to OLDfile. 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gateOLD= 36*7c478bd9Sstevel@tonic-gateMODE= 37*7c478bd9Sstevel@tonic-gateOWNER= 38*7c478bd9Sstevel@tonic-gateGROUP= 39*7c478bd9Sstevel@tonic-gateFILE= 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gatewhile [ $# -gt 0 ] 42*7c478bd9Sstevel@tonic-gatedo 43*7c478bd9Sstevel@tonic-gate case $1 in 44*7c478bd9Sstevel@tonic-gate -o) OLD="OLD" 45*7c478bd9Sstevel@tonic-gate shift 46*7c478bd9Sstevel@tonic-gate ;; 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate -f) shift 49*7c478bd9Sstevel@tonic-gate DIR=$1 50*7c478bd9Sstevel@tonic-gate shift 51*7c478bd9Sstevel@tonic-gate ;; 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate -f*) DIR=`echo $1|sed "s/..//"` 54*7c478bd9Sstevel@tonic-gate shift 55*7c478bd9Sstevel@tonic-gate ;; 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate -m) shift 58*7c478bd9Sstevel@tonic-gate MODE=$1 59*7c478bd9Sstevel@tonic-gate shift 60*7c478bd9Sstevel@tonic-gate ;; 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate -m*) MODE=`echo $1|sed "s/..//"` 63*7c478bd9Sstevel@tonic-gate shift 64*7c478bd9Sstevel@tonic-gate ;; 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate -u) shift 67*7c478bd9Sstevel@tonic-gate OWNER=$1 68*7c478bd9Sstevel@tonic-gate shift 69*7c478bd9Sstevel@tonic-gate ;; 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate -u*) OWNER=`echo $1|sed "s/..//"` 72*7c478bd9Sstevel@tonic-gate shift 73*7c478bd9Sstevel@tonic-gate ;; 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate -g) shift 76*7c478bd9Sstevel@tonic-gate GROUP=$1 77*7c478bd9Sstevel@tonic-gate shift 78*7c478bd9Sstevel@tonic-gate ;; 79*7c478bd9Sstevel@tonic-gate 80*7c478bd9Sstevel@tonic-gate -g*) GROUP=`echo $1|sed "s/..//"` 81*7c478bd9Sstevel@tonic-gate shift 82*7c478bd9Sstevel@tonic-gate ;; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate *) FILE=$1 85*7c478bd9Sstevel@tonic-gate break 86*7c478bd9Sstevel@tonic-gate ;; 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate esac 89*7c478bd9Sstevel@tonic-gatedone 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gateif [ -z "$FILE" -o -z "$DIR" ]; then 93*7c478bd9Sstevel@tonic-gate echo $USAGE 94*7c478bd9Sstevel@tonic-gate exit 1 95*7c478bd9Sstevel@tonic-gatefi 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gateif [ -n "$OLD" ]; then 98*7c478bd9Sstevel@tonic-gate echo mv $DIR/$FILE $DIR/OLD$FILE 99*7c478bd9Sstevel@tonic-gate mv $DIR/$FILE $DIR/OLD$FILE 100*7c478bd9Sstevel@tonic-gatefi 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gaterm -f $DIR/$FILE 103*7c478bd9Sstevel@tonic-gateecho cp $FILE $DIR/$FILE 104*7c478bd9Sstevel@tonic-gatecp $FILE $DIR/$FILE 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gateif [ -n "$GROUP" ]; then 107*7c478bd9Sstevel@tonic-gate echo chgrp $GROUP $DIR/$FILE 108*7c478bd9Sstevel@tonic-gate chgrp $GROUP $DIR/$FILE 109*7c478bd9Sstevel@tonic-gatefi 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gateif [ -n "$MODE" ]; then 112*7c478bd9Sstevel@tonic-gate echo chmod $MODE $DIR/$FILE 113*7c478bd9Sstevel@tonic-gate chmod $MODE $DIR/$FILE 114*7c478bd9Sstevel@tonic-gatefi 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gateif [ -n "$OWNER" ]; then 118*7c478bd9Sstevel@tonic-gate echo chown $OWNER $DIR/$FILE 119*7c478bd9Sstevel@tonic-gate chown $OWNER $DIR/$FILE 120*7c478bd9Sstevel@tonic-gatefi 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gatels -l $DIR/$FILE 123