1#! /bin/sh 2# 3# @(#)install.sh 4.5 (Berkeley) 10/12/83 4# 5cmd=/bin/mv 6strip="" 7chmod="chmod 755" 8if [ "`uname -s`" = "HP-UX" ] ; then 9 chown="chown root" 10 chgrp="chgrp bin" 11else 12 chown="chown -f root" 13 chgrp="chgrp -f bin" 14fi 15while true ; do 16 case $1 in 17 -s ) strip="strip" 18 shift 19 ;; 20 -c ) cmd="cp" 21 shift 22 ;; 23 -m ) chmod="chmod $2" 24 shift 25 shift 26 ;; 27 -o ) chown="chown -f $2" 28 shift 29 shift 30 ;; 31 -g ) chgrp="chgrp -f $2" 32 shift 33 shift 34 ;; 35 -d ) cmd="mkdir" 36 shift 37 ;; 38 * ) break 39 ;; 40 esac 41done 42 43if [ ! ${2-""} ] 44then echo "install: no destination specified" 45 exit 1 46fi 47if [ ${3-""} ] 48then echo "install: too many files specified -> $*" 49 exit 1 50fi 51if [ $1 = $2 -o $2 = . ] 52then echo "install: can't move $1 onto itself" 53 exit 1 54fi 55case $cmd in 56/bin/mkdir ) 57 file=$2/$1 58 ;; 59* ) 60 if [ '!' -f $1 ] 61 then echo "install: can't open $1" 62 exit 1 63 fi 64 if [ -d $2 ] 65 then file=$2/$1 66 else file=$2 67 fi 68 /bin/rm -f $file 69 ;; 70esac 71 72case $cmd in 73/bin/mkdir ) 74 if [ ! -d "$file" ] 75 then $cmd $file 76 fi 77 ;; 78* ) 79 $cmd $1 $file 80 if [ $strip ] 81 then $strip $file 82 fi 83 ;; 84esac 85 86$chown $file 87$chgrp $file 88$chmod $file 89