opkg-link-clean 449 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. #
  3. # Find dangling symlinks that point into
  4. # opkg destination
  5. #
  6. # this script must be called with an pkg destination as first
  7. # argument
  8. #
  9. # By Stefan Tomanek <stefan@pico.ruhr.de>
  10. DEST=$1
  11. DDIR=`awk -vDEST=$DEST '$1 == "dest" && $2 == DEST { print $3 }' /etc/opkg.conf`
  12. [ -z "$DDIR" ] && exit 1
  13. find / -xdev -type l | while read L; do
  14. readlink $L
  15. done | grep "^${DDIR}" | while read T; do
  16. [ ! -e "$T" ] && echo ${T#$DDIR}
  17. done