1997-08-22 00:57:35 +02:00
|
|
|
#!/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"
|
|
|
|
|
2000-07-07 15:18:48 +02:00
|
|
|
if test $# -lt 1; then
|
|
|
|
echo "symlink-tree error: Usage: symlink-tree srcdir \"ignore1 ignore2 ...\""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
ignore_additional=". .. CVS"
|
|
|
|
|
|
|
|
# If we were invoked with a relative path name, adjust ${prog} to work
|
|
|
|
# in subdirs.
|
|
|
|
case ${prog} in
|
2000-12-09 17:06:19 +01:00
|
|
|
/* | [A-Za-z]:[\\/]*) ;;
|
1997-08-22 00:57:35 +02:00
|
|
|
*) prog=../${prog} ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Set newsrcdir to something subdirectories can use.
|
|
|
|
case ${srcdir} in
|
2000-12-09 17:06:19 +01:00
|
|
|
/* | [A-Za-z]:[\\/]*) newsrcdir=${srcdir} ;;
|
1997-08-22 00:57:35 +02:00
|
|
|
*) 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
|