find-provides-texlive.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. # find-provides-texlive.sh
  3. # based on /usr/lib/rpm/find-provides
  4. # This script reads filenames from STDIN and outputs any relevant provides
  5. # information that needs to be included in the package.
  6. # VINE: newer objdump (in binutils) has translated messages,
  7. # so at a moment we need to set LANG to C
  8. LANG=C
  9. filelist=`sed "s/['\"]/\\\&/g"`
  10. solist=$(echo $filelist | grep "\\.so" | grep -v "^/lib/ld.so" | \
  11. xargs file -L 2>/dev/null | grep "ELF.*shared object" | cut -d: -f1)
  12. pythonlist=
  13. tcllist=
  14. #
  15. # --- Alpha does not mark 64bit dependencies
  16. case `uname -m` in
  17. alpha*) mark64="" ;;
  18. *) mark64="()(64bit)" ;;
  19. esac
  20. #
  21. # --- Library sonames and weak symbol versions (from glibc).
  22. for f in $solist; do
  23. soname=$(objdump -p $f | awk '/SONAME/ {print $2}')
  24. lib64=`if file -L $f 2>/dev/null | \
  25. grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
  26. if [ "$soname" != "" ]; then
  27. if [ ! -L $f ]; then
  28. echo $soname$lib64
  29. objdump -p $f | awk '
  30. BEGIN { START=0 ; }
  31. /Version definitions:/ { START=1; }
  32. /^[0-9]/ && (START==1) { print $4; }
  33. /^$/ { START=0; }
  34. ' | \
  35. grep -v $soname | \
  36. while read symbol ; do
  37. echo "$soname($symbol)`echo $lib64 | sed 's/()//'`"
  38. done
  39. fi
  40. else
  41. echo ${f##*/}$lib64
  42. fi
  43. done | sort -u
  44. # #
  45. # # --- Perl modules.
  46. # [ -x /usr/lib/rpm/perl.prov ] &&
  47. # echo $filelist | tr '[:blank:]' \\n | grep '\.pm$' | /usr/lib/rpm/perl.prov | sort -u
  48. # #
  49. # # --- Python modules.
  50. # [ -x /usr/lib/rpm/python.prov -a -n "$pythonlist" ] &&
  51. # echo $pythonlist | tr '[:blank:]' \\n | /usr/lib/rpm/python.prov | sort -u
  52. # #
  53. # # --- Tcl modules.
  54. # [ -x /usr/lib/rpm/tcl.prov -a -n "$tcllist" ] &&
  55. # echo $tcllist | tr '[:blank:]' \\n | /usr/lib/rpm/tcl.prov | sort -u
  56. # #
  57. # # --- Mono modules.
  58. # [ -x /usr/lib/rpm/mono-find-provides -a -n "$filelist" ] &&
  59. # echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/mono-find-provides | sort -u
  60. exit 0