blob: 5b18cab92388f5d9bfde8e1f43f21a3cb21b74fd (
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
|
#!/bin/sh
# Create a symlink tree.
#
# Syntax: symlink-tree srcdir "ignore1 ignore2 ..."
#
# where srcdir is the directory to create a symlink tree to,
# and "ignoreN" is a list of files/directories to ignore.
prog=$0
srcdir=$1
ignore="$2"
if test $# -lt 1; then
echo "symlink-tree error: Usage: symlink-tree srcdir \"ignore1 ignore2 ...\""
exit 1
fi
ignore_additional=". .. CVS"
# If we were invoked with a relative path name, adjust ${prog} to work
# in subdirs.
case ${prog} in
/* | [A-Za-z]:[\\/]*) ;;
*) prog=../${prog} ;;
esac
# Set newsrcdir to something subdirectories can use.
case ${srcdir} in
/* | [A-Za-z]:[\\/]*) newsrcdir=${srcdir} ;;
*) newsrcdir=../${srcdir} ;;
esac
for f in `ls -a ${srcdir}`; do
if [ -d ${srcdir}/$f ]; then
found=
for i in ${ignore} ${ignore_additional}; do
if [ "$f" = "$i" ]; then
found=yes
fi
done
if [ -z "${found}" ]; then
echo "$f ..working in"
if [ -d $f ]; then true; else mkdir $f; fi
(cd $f; ${prog} ${newsrcdir}/$f "${ignore}")
fi
else
echo "$f ..linked"
rm -f $f
ln -s ${srcdir}/$f .
fi
done
exit 0
|