#!/bin/sh # I can't figure out how I'm supposed to use a builtin "install" # program in a makefile given that every Unix has an incompatible version! # This script shall behave similarly to GNU "install". version="1.1 Time-stamp: " echo= strip=: while test $# -gt 0; do case $1 in -c) ;; -n|--no-create) echo=echo ;; --g*=*) group=`expr $1 : '.*=\(.*\)$'` ;; -g|--g*) group=$2; shift ;; -g*) group=`expr $1 : '-.\(.*\)$'` ;; --o*=*) owner=`expr $1 : '.*=\(.*\)$'` ;; -o|--o*) owner=$2; shift ;; -o*) owner=`expr $1 : '-.\(.*\)$'` ;; --m*=*) mode=`expr $1 : '.*=\(.*\)$'` ;; -m|--m*) mode=$2; shift ;; -m*) mode=`expr $1 : '-.\(.*\)$'` ;; -s|--strip) strip=strip ;; -h|--help) cat <<@EOF $0 -- install files usage: $0 [ OPTION ]... FILE1 FILE2 $0 [ OPTION ]... FILE1...FILEn DIR $0 --help | --version options: -c ignored --group=GROUP --owner=USER --mode=MODE -g GROUP -o USER -m MODE --strip -s @EOF exit 0 ;; -V|--version) echo "PDCMAC install ($0) version $version" exit 0 ;; -*) echo >&2 $0: $1: not understood -- try $0 --help exit 2 ;; *) files="$files $lastfile" lastfile=$1 ;; esac shift done #echo group=$group owner=$owner mode=$mode lastfile=$lastfile files=$files $echo cp -p $files $lastfile || exit 1 if test -d "$lastfile"; then $echo cd $lastfile else files="$lastfile" fi if test -n "$group"; then $echo chgrp $group $files || exit 1 fi if test -n "$owner"; then $echo chown $owner $files || exit 1 fi if test -n "$mode"; then $echo chmod $mode $files || exit 1 fi $echo $strip $files exit 0