infrastructure/fix-links

16 lines
299 B
Text
Raw Permalink Normal View History

2021-02-20 03:33:36 +00:00
#!/bin/sh
set -e
cd "$1"
BROKEN_LINKS=$(find . -xtype l)
for link in $BROKEN_LINKS; do
src=$(readlink "$link")
if echo "$src" | grep -q '^\.\./\.\./lib/'; then
# Relink without relative part
new_src=$(echo "$src" | sed 's!^\.\./\.\./lib/!!')
ln -vsf "$new_src" "$link"
fi
done