1
0
Files
irix-657m-src/eoe/cmd/sendmail/symlink-tree
2022-09-29 17:59:04 +03:00

40 lines
649 B
Bash
Executable File

#!/bin/sh
COMMAND=$1
DEST=$2
if ! test -d "$DEST"; then
echo "DEST directory $DIST does not exist"
exit 1
fi
cd $DEST
if test "$COMMAND" = "preserve"; then
if test ! -e .symlinks ; then
find . -type l -print | xargs ls -l | awk '{print $9,$11}' > .symlinks.tmp
if test -s .symlinks.tmp; then
mv .symlinks.tmp .symlinks
else
rm -f .symlinks.tmp
fi
fi
COMMAND=clobber
fi
if test "$COMMAND" = "clobber"; then
find . -type l -print | xargs rm -f
fi
if test "$COMMAND" = "restore"; then
cat .symlinks | while read line; do
set $line
if ! test -l $1; then
ln -s $2 $1
fi
done
fi