/[resiprocate]/main/build/lndir.sh
ViewVC logotype

Contents of /main/build/lndir.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5295 - (show annotations) (download) (as text)
Mon Aug 22 00:30:05 2005 UTC (14 years, 2 months ago) by jason
File MIME type: application/x-sh
File size: 1616 byte(s)
merged 5270:HEAD from b-directory-reorg
1 #! /bin/sh
2
3 # lndir - create shadow link tree
4 #
5 # $XConsortium: lndir.sh,v 1.8 91/04/15 17:55:03 rws Exp $
6 #
7 # Used to create a copy of the a directory tree that has links for all
8 # non- directories (except those named CVS, RCS, or SCCS). If you are
9 # building the distribution on more than one machine, you should use
10 # this script.
11 #
12 # If your master sources are located in /usr/local/src/X and you would like
13 # your link tree to be in /usr/local/src/new-X, do the following:
14 #
15 # % mkdir /usr/local/src/new-X
16 # % cd /usr/local/src/new-X
17 # % lndir ../X
18
19 USAGE="Usage: $0 fromdir [todir]"
20
21 if [ $# -lt 1 -o $# -gt 2 ]
22 then
23 echo "$USAGE"
24 exit 1
25 fi
26
27 DIRFROM=$1
28
29 if [ $# -eq 2 ];
30 then
31 DIRTO=$2
32 else
33 DIRTO=.
34 fi
35
36 if [ ! -d $DIRTO ]
37 then
38 mkdir -p $DIRTO
39 fi
40
41 cd $DIRTO
42
43 if [ ! -d $DIRFROM ]
44 then
45 echo "$0: $DIRFROM is not a directory"
46 echo "$USAGE"
47 exit 2
48 fi
49
50 pwd=`pwd`
51
52 if [ `(cd $DIRFROM; pwd)` = $pwd ]
53 then
54 echo "$pwd: FROM and TO are identical!"
55 exit 1
56 fi
57
58 for file in `ls -af $DIRFROM`
59 do
60 if [ ! -d $DIRFROM/$file ]
61 then
62 # echo "linking $DIRFROM/$file to pwd"
63 ln -s $DIRFROM/$file . > /dev/null 2>&1
64 else
65 if [ $file != CVS -a $file != RCS -a $file != SCCS -a $file != . -a $file != .. ]
66 then
67 echo $file:
68 mkdir -p $file > /dev/null 2>&1
69 (cd $file
70 pwd=`pwd`
71 case "$DIRFROM" in
72 /*) ;;
73 *) DIRFROM=../$DIRFROM ;;
74 esac
75 if [ `(cd $DIRFROM/$file; pwd)` = $pwd ]
76 then
77 echo "$pwd: FROM and TO are identical!"
78 exit 1
79 fi
80 $0 $DIRFROM/$file
81 )
82 fi
83 fi
84 done
85
86 exit 0

Properties

Name Value
svn:executable *
svn:mime-type application/x-sh

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27