3 # lndir - create shadow link tree
5 # Time stamp <89/11/28 18:56:54 gildea>
6 # By Stephen Gildea <gildea@bbn.com> based on
7 # XConsortium: lndir.sh,v 1.1 88/10/20 17:37:16 jim Exp
9 # Used to create a copy of the a directory tree that has links for all non-
10 # directories (except those named RCS). If you are building the distribution
11 # on more than one machine, you should use this script.
13 # If your master sources are located in /usr/local/src/X and you would like
14 # your link tree to be in /usr/local/src/new-X, do the following:
16 # % mkdir /usr/local/src/new-X
17 # % cd /usr/local/src/new-X
20 # Note: does not link files beginning with "." Is this a bug or a feature?
22 # Improvements over R3 version:
23 # Allows the fromdir to be relative: usually you want to say "../dist"
24 # The name is relative to the todir, not the current directory.
26 # Bugs in R3 version fixed:
27 # Do "pwd" command *after* "cd $DIRTO".
28 # Don't try to link directories, avoiding error message "<dir> exists".
29 # Barf with Usage message if either DIRFROM *or* DIRTO is not a directory.
31 USAGE="Usage: $0 fromdir [todir]"
35 */*) lndir=`pwd`/$0 ;;
39 if [ $# -lt 1 -o $# -gt 2 ]
56 echo "$0: $DIRTO is not a directory"
65 echo "$0: $DIRFROM is not a directory"
72 if [ `(cd $DIRFROM; pwd)` = $pwd ]
74 echo "$pwd: FROM and TO are identical!"
78 for file in `ls -a $DIRFROM`
80 if [ ! -d $DIRFROM/$file ]
82 ln -s $DIRFROM/$file .
84 if [ $file != RCS -a $file != CVS -a $file != . -a $file != .. ]
92 *) DIRFROM=../$DIRFROM ;;
94 if [ `(cd $DIRFROM/$file; pwd)` = $pwd ]
96 echo "$pwd: FROM and TO are identical!"