File: bsdinstall.in

package info (click to toggle)
blackened 1.8.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,916 kB
  • ctags: 3,389
  • sloc: ansic: 46,055; sh: 554; makefile: 270; perl: 46
file content (92 lines) | stat: -rwxr-xr-x 1,197 bytes parent folder | download
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
87
88
89
90
91
92
#! /bin/sh
#
#	@(#)install.sh	4.5	(Berkeley)	10/12/83
#
# @(#)$Id: bsdinstall.in,v 1.1 2001/12/10 00:29:54 toast Exp $
#
cmd=@MVCMD@
strip=""
chmod="@CHMOD@ 755"
chown=""
chgrp=""
while true ; do
	case $1 in
		-s )	strip="@STRIP@"
			shift
			;;
		-c )	cmd="@CPCMD@"
			shift
			;;
		-m )	chmod="@CHMOD@ $2"
			shift
			shift
			;;
		-o )	chown="@CHOWN@ -f $2"
			shift
			shift
			;;
		-g )	chgrp="@CHGRP@ -f $2"
			shift
			shift
			;;
		-d )	cmd="@MKDIR@"
			shift
			;;
		* )	break
			;;
	esac
done

if test ! ${2-""}; then
	echo "install: no destination specified"
	exit 1
fi
if test ${3-""}; then
	echo "install: too many files specified -> $*"
	exit 1
fi
if test $1 = $2 -o $2 = .; then
	echo "install: can't move $1 onto itself"
	exit 1
fi
case $cmd in
@MKDIR@ )
	file=$2/$1
	;;
* )
	if test '!' -f $1; then
		echo "install: can't open $1"
		exit 1
	fi
	if test -d $2; then
		file=$2/$1
	else
		file=$2
	fi
	@RMCMD@ -f $file
	;;
esac

case $cmd in
@MKDIR@ )
	if test ! -d "$file"; then
		$cmd $file
	fi
	;;
* )
	$cmd $1 $file
	if test -n "$strip"; then
		$strip $file
	fi
	;;
esac

if test -n "$chown"; then
	$chown $file
fi
if test -n "$chgrp"; then
	$chgrp $file
fi
$chmod $file

exit 0