brokenpkg 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. # 2004/08/22 K. Piche Find missing library references.
  3. # 2015/11/27 orbea Refreshed script
  4. # 2016/12/23 orbea Format cleanup
  5. # 2017/06/16 orbea Optimization + cleanup
  6. # 2018/02/10 orbea Silence ldd warnings
  7. # 2018/03/07 orbea Silence find errors for missing directories
  8. # 2018/03/11 orbea Reduce indentation
  9. ifs=$IFS
  10. IFS=':'
  11. ARCH=`uname -m`
  12. libdirs="/lib:/usr/lib:/usr/X11R6/lib:/usr/libexec:/usr/$ARCH-slackware-linux:/lib64:/usr/lib64:/usr/X11R6/lib64"
  13. extras=
  14. # Check ELF binaries in the PATH and specified dir trees.
  15. for tree in $PATH $libdirs $extras; do
  16. [ -d "$tree" ] || continue
  17. printf %s\\n "DIR $tree"
  18. # Get list of files in tree.
  19. files=`find "$tree" -type f`
  20. IFS=$ifs
  21. for i in $files; do
  22. [ -r "$i" ] || continue
  23. type=`file "$i"`
  24. case "$type" in *ELF*)
  25. # Is an ELF binary.
  26. ldd=`ldd "$i" 2>/dev/null`
  27. case "$ldd" in *'not found'*)
  28. # Missing lib.
  29. printf %s\\n "$i:"
  30. printf %s\\n "$ldd" | grep 'not found' ;;
  31. esac ;;
  32. esac
  33. done
  34. done
  35. exit 0