File: install-recursive.sh

package info (click to toggle)
openmsx-debugger 0.1~git20160326-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 2,036 kB
  • ctags: 1,708
  • sloc: cpp: 11,862; python: 518; sh: 45; makefile: 13
file content (50 lines) | stat: -rwxr-xr-x 631 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# $Id$

if [ $# -lt 2 ]
then
	echo "Usage: $0 (<src-file>|<src-dir>)+ <dst-dir>" >&2
	exit 1
fi

if [ $# -eq 2 ]
then
	src="$1"
	shift
	if [ -d "$src" ]
	then
		src="$src"/*
	fi
else
	src=""
	while [ $# -ne 1 ]
	do
		src="$src $1"
		shift
	done
fi
dst="$1"

for path in $src
do
	name=$(basename "$path")
	dir=$(dirname "$path")
	if [ -L "$path" ]
	then
		echo "skipping symbolic link: $path"
	elif [ -d "$path" ]
	then
		if [ "$name" != .svn ]
		then
			$0 "$path" "$dst"
		fi
	else
		install -m 0755 -d "$dst/$dir"
		mode=0644
		if [ -x "$path" ]
		then
			mode=0755
		fi
		install -m $mode "$path" "$dst/$dir"
	fi
done