mvlinks
1.08 KB
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
#!/bin/sh
#
# $1 = full file name w/path
# $2 = source tree root
# $3 = destination tree root
#
# This script takes a file that is a symbolic link and make a new link in the
# destination tree with the following rules
#
# If $1 contains "RCS" in symbolic link name, remove it in destination symbolic
# name. This has the effect of making a symbolic link in a tree that does not
# have RCS directories. This is a step we need to do to make symbolic links in
# cvs tree to reflect the symbolic link in the ptools tree.
#
# If $1 is a symbolic link and DO NOT CONTAIN "RCS" in file name, make the
# same link in destination tree. This preserves any symbolic links to
# directories.
#
# if directory links, don't strip ../, else ,v links, do strip
if test -d $1
then
LINK=`/bin/ls -l $2/$1 | sed -e "s/.*> //"`
else
LINK=`/bin/ls -l $2/$1 | sed -e "s/.*> ..\///" | sed -e "s/\/RCS//"`
fi
ABSLINKS=`echo $LINK | grep mdev2`
if test -z "$ABSLINKS"
then
echo $1
else
echo ABSOLUTE LINK, fix w/fixabslinks - $1
exit 0
fi
NEWFILE=`echo $3/$1 | sed -e "s/\/RCS//"`
rm -f $NEWFILE
ln -s $LINK $NEWFILE