summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/pdcmac/pinstall
blob: c9b6b95638598306b761346f2d769ad488c63d41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/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: <pdc 1995-03-24>"

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