| 1 | #!/bin/sh |
| 2 | |
| 3 | if [ $# -lt 2 ] |
| 4 | then |
| 5 | echo "Usage: $0 (<src-file>|<src-dir>)+ <dst-dir>" >&2 |
| 6 | exit 1 |
| 7 | fi |
| 8 | |
| 9 | if [ $# -eq 2 ] |
| 10 | then |
| 11 | src="$1" |
| 12 | shift |
| 13 | if [ -d "$src" ] |
| 14 | then |
| 15 | src="$src"/* |
| 16 | fi |
| 17 | else |
| 18 | src="" |
| 19 | while [ $# -ne 1 ] |
| 20 | do |
| 21 | src="$src $1" |
| 22 | shift |
| 23 | done |
| 24 | fi |
| 25 | dst="$1" |
| 26 | |
| 27 | for path in $src |
| 28 | do |
| 29 | name=$(basename "$path") |
| 30 | dir=$(dirname "$path") |
| 31 | if [ -L "$path" ] |
| 32 | then |
| 33 | echo "skipping symbolic link: $path" |
| 34 | elif [ -d "$path" ] |
| 35 | then |
| 36 | if [ "$name" != .svn ] |
| 37 | then |
| 38 | $0 "$path" "$dst" |
| 39 | fi |
| 40 | else |
| 41 | install -m 0755 -d "$dst/$dir" |
| 42 | mode=0644 |
| 43 | if [ -x "$path" ] |
| 44 | then |
| 45 | mode=0755 |
| 46 | fi |
| 47 | install -m $mode "$path" "$dst/$dir" |
| 48 | fi |
| 49 | done |