blob: 00b0e3a2a41a1d066fd8bcdfc7a108775f1d8fb2 (
plain) (
blame)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#!/bin/sh
##
## mkshadow.sh -- create a shadow tree
##
## Initially written by Ralf S. Engelschall <rse@apache.org>
## for the shadow tree generation option (--shadow) of
## Apache's Autoconf-style Interface (APACI)
##
#
# This script falls under the Apache License.
# See http://www.apache.org/docs/LICENSE
# default IFS
DIFS='
'
# source and destination directory
src=`echo $1 | sed -e 's:/$::'`
dst=`echo $2 | sed -e 's:/$::'`
# check whether source exists
if [ ! -d $src ]; then
echo "mkshadow.sh:Error: source directory not found" 1>&2
exit 1
fi
# determine if one of the paths is an absolute path,
# because then we have to use an absolute symlink
oneisabs=0
case $src in
/* ) oneisabs=1 ;;
esac
case $dst in
/* ) oneisabs=1 ;;
esac
# determine reverse directory for destination directory
dstrevdir=''
if [ "x$oneisabs" = "x0" ]; then
# (inlined fp2rp)
OIFS2="$IFS"; IFS='/'
for pe in $dst; do
dstrevdir="../$dstrevdir"
done
IFS="$OIFS2"
else
src="`cd $src; pwd`";
fi
# create directory tree at destination
if [ ! -d $dst ]; then
mkdir $dst
fi
DIRS="`cd $src; \
find . -type d -print |\
sed -e '/\/CVS/d' \
-e '/^\.$/d' \
-e 's:^\./::'`"
OIFS="$IFS" IFS="$DIFS"
for dir in $DIRS; do
mkdir $dst/$dir
done
IFS="$OIFS"
# fill directory tree with symlinks to files
FILES="`cd $src; \
find . -depth -print |\
sed -e '/\.o$/d' \
-e '/\.a$/d' \
-e '/\.so$/d' \
-e '/\.so-o$/d' \
-e '/\.cvsignore$/d' \
-e '/\/CVS/d' \
-e '/\.indent\.pro$/d' \
-e '/\.apaci.*/d' \
-e '/Makefile$/d' \
-e '/\/\.#/d' \
-e '/\.orig$/d' \
-e 's/^\.\///'`"
OIFS="$IFS" IFS="$DIFS"
for file in $FILES; do
# don't use `-type f' above for find because of symlinks
if [ -d "$src/$file" ]; then
continue
fi
basename=`echo $file | sed -e 's:^.*/::'`
dir=`echo $file | sed -e 's:[^/]*$::' -e 's:/$::' -e 's:$:/:' -e 's:^/$::'`
from="$src/$file"
to="$dst/$dir$basename"
if [ "x$oneisabs" = "x0" ]; then
if [ "x$dir" != "x" ]; then
subdir=`echo $dir | sed -e 's:/$::'`
# (inlined fp2rp)
revdir=''
OIFS2="$IFS"; IFS='/'
for pe in $subdir; do
revdir="../$revdir"
done
IFS="$OIFS2"
# finalize from
from="$revdir$from"
fi
from="$dstrevdir$from"
fi
echo " $to"
ln -s $from $to
done
IFS="$OIFS"
|