#!/bin/bash # # Rebuilds symlinks as specified in a ./.cvs-symlinks file. # # Usage: csym-update [-r|] # # Check for recursive usage # [ "$1" = "-r" ] && \ exec find . -type d -exec $0 \{\} \; # Slow, simple & should work! # Check for directory parameter # if [ "$1" != "" ]; then [ -d "$1" ] || \ { echo echo "Usage: $0 [-r|]" echo echo "Note that the directory must already be in CVS." echo "(you tried $0 $*)" echo exit 1 } [ -f "$1/.cvs-symlinks" ] && cd "$1" && pwd || exit 1 fi RET=" " cat .cvs-symlinks | sed -e "s/ -> /\\$RET/" |\ ( while read NAME && read TARGET; do if [ ! -e "$NAME" -o -L "$NAME" ]; then rm -f "$NAME" ln -vs "$TARGET" "$NAME" else echo "csym-update: $(pwd)/$NAME is in the way, cannot update." fi done )