diff --git a/lib/functions.in b/lib/functions.in index b049551..8d6e1cf 100644 --- a/lib/functions.in +++ b/lib/functions.in @@ -311,12 +311,29 @@ function run_check() { # make symlinks relative # postflist_dirty_symlinks() { - local dfn= ffn= echo "Processing symlink corrections ..." + while read fn; do local ffn="$root/$fn" - if [ -L "$ffn" -a ! -e "$ffn" ]; then - echo_warning "broken symlink: $fn" + if [ -L "$ffn" ]; then + local dfn=$(readlink "$ffn") + if [ "${dfn:0:1}" = '/' ]; then + local dfn2="${dfn#$root}" + if [ "$dfn2" != "$dfn" ]; then + echo_warning "dirty symlink: $fn" + dfn="$dfn2" + else + dfn2= + fi + + if [ ! -e "$root$dfn" ]; then + echo_warning "broken absolute symlink: $fn" + elif [ -z "$dfn2" ]; then # haven't said it's dirty already + echo_warning "absolute symlink: $fn" + fi + elif [ ! -e "$ffn" ]; then + echo_warning "broken symlink: $fn" + fi fi done < "$builddir/flist.txt" }