3 # fixlinks - make symlinks in the bash source tree so that there is
4 # exactly one version of any given source file.
11 -s) shift; SRCDIR=$1 ;;
14 -*) echo "$0: $1: bad option" 1>&2
15 echo "$0: usage: $0 [-hu] [-s srcdir] [linkmap]" 1>&2
22 if [ ! -d $SRCDIR/builtins ]; then
23 echo "$0: must be run with valid -s argument or from source directory" 1>&2
28 linkfile=$SRCDIR/support/SYMLINKS
33 if [ ! -f "$linkfile" ]; then
34 echo "$0: symlink map file \`$linkfile' does not exist"
39 LINKTEMP=`mktemp -t linktmp.XXXXXXXX 2>/dev/null`
40 if [ -z "$LINKTEMP" ]; then
42 LINKTEMP=${TMPDIR}/linktmp.$$
46 $rm_ltmp && rm -f ${LINKTEMP}
47 # if the user specified hard links, then do that. otherwise, try to use
48 # symlinks if they're present
49 if [ -n "$hardlinks" ]; then
51 elif (ln -s /dev/null ${LINKTEMP}) >/dev/null 2>&1; then
58 while read name target
66 yes) dirname=`expr "$name" ':' '^\(.*\)/[^/]*'`
67 [ -z "$dirname" ] && dirname=.
68 cp $dirname/$target $name
69 echo $target copied to $name ;;
70 *) $LN $target $name ; echo "$name -> $target" ;;