blob: bc286e5a9df37a8d0b58bf36513786c0000fc8c8 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#! /bin/sh
#
# fixlinks - make symlinks in the bash source tree so that there is
# exactly one version of any given source file.
#
#
SRCDIR=.
while [ $# -gt 0 ]; do
case "$1" in
-s) shift; SRCDIR=$1 ;;
-u) unfix=yes ;;
-h) hardlinks=yes ;;
-*) echo "$0: $1: bad option" 1>&2
echo "$0: usage: $0 [-hu] [-s srcdir] [linkmap]" 1>&2
exit 1;;
*) break ;;
esac
shift
done
if [ ! -d $SRCDIR/builtins ]; then
echo "$0: must be run with valid -s argument or from source directory" 1>&2
exit 1
fi
if [ $# -eq 0 ]; then
linkfile=$SRCDIR/support/SYMLINKS
else
linkfile=$1
fi
if [ ! -f "$linkfile" ]; then
echo "$0: symlink map file \`$linkfile' does not exist"
exit 1
fi
rm -f /tmp/z
# if the user specified hard links, then do that. otherwise, try to use
# symlinks if they're present
if [ -n "$hardlinks" ]; then
LN=ln
elif (ln -s /dev/null /tmp/z) >/dev/null 2>&1; then
LN="ln -s"
else
LN=ln
fi
rm -f /tmp/z
while read name target
do
case "$name" in
\#*) continue;;
esac
rm -f $name
case "$unfix" in
yes) dirname=`expr "$name" ':' '^\(.*\)/[^/]*'`
[ -z "$dirname" ] && dirname=.
cp $dirname/$target $name
echo $target copied to $name ;;
*) $LN $target $name ; echo "$name -> $target" ;;
esac
done < $linkfile
exit 0
|