Browse Source

[initramfs] Improved to detect and remove broken symlinks

This fixes a problem when early is built for 64 lib/ is a symlink to lib64/ which is deleted for been empty
/proc, absolute and relative paths handled
karasz/new-early
Alejandro Mery 16 years ago
parent
commit
efa2d66f0d
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      target/share/initramfs/build.sh

+ 17
- 0
target/share/initramfs/build.sh

@ -76,6 +76,23 @@ echo_status "Removing empty folders ..."
fi
done
echo_status "Checking for broken symlinks ..."
( cd "$rootfs"; find . -type l ) | while read link; do
target=$( readlink "$rootfs/$link" )
case "$target" in
/proc/*) continue ;;
/*) # absolute
;;
*) target="/${link%/*}/${target}" # relative
;;
esac
if [ ! -e "$rootfs$target" ]; then
echo_warning "- $link is broken, deleting."
rm -f "$rootfs/$link"
fi
done
# sanity checks
#
[ -x "$rootfs/init" ] || echo_warning "This image is missing an /init file, it wont run."

Loading…
Cancel
Save