Mailing List Archive

Symlink tree builder
Excerpts from the mail message of Tim Bunce:
) Could you submit the utility which builds the symlink trees for
) inclusion in the distribution.
)
) It sounds like it has a high utility/size ratio.

Here is one that doesn't use MANIFEST (just "make distclean"
before you run it). Feel free to use it or throw it away (it
didn't take a lot of work to write).

--
Tye McQueen tye@metronet.com || tye@doober.usu.edu
Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)

#!/bin/sh
# Usage: rembuild.sh /path/to/read-only/source/for/perl5
# Set up symbolic links from current directory to the source tree for a
# package (like perl5) in such a way that you can build in the current
# directory without making any changes to the original source tree.

if [ 1 != $# -o ! -d "$1" ]; then
echo "Usage: $0 /path/to/source/for/package"
exit 1
fi

if [ 2 != `ls -a . | wc -w` ]; then
echo "You probably don't want to run this here"
echo "since there are already files in this directory!!"
echo " "
fi

echo "This script is about to make symbolic links from this directory"
echo "to all files and subdirectories of $1/."
echo "This should allow you to build in your current working directory"
echo "the package whose source is in that directory without disturbing"
echo "the source code (and without needing write access to it)."
echo " "
echo "Do you want to continue? \c"
read okay || exit 1
case "$okay" in
y*) ;;
*) echo "Aborting. No changes have been made."
exit;;
esac

linkdir() {
echo "Linking $1..."
for f in `ls "$1"`; do
ln -s "$1/$f" .
done
for d in `ls -d */. 2>/dev/null`; do
d=`expr match "$d" '\(.*\)/\.'`
rm -f $d
mkdir $d
cd $d
( linkdir "$1/$d" )
cd ..
done
}

linkdir "$1"

if [ -f makefile -o -f Makefile ]; then
echo " % make distclean"
make distclean
fi

if [ -r Configure ]; then
echo "You should be able to run ./Configure from this directory now."
elif [ -r configure ]; then
echo "You should be able to run ./configure from this directory now."
else
echo "You should be able to build in this directory now."
fi
# END